Sfoglia il codice sorgente

Invalidate all sessions after password change

Charles Shen 1 anno fa
parent
commit
bb38eb3c03
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. 4 0
      example/admin/auth.go

+ 4 - 0
example/admin/auth.go

@@ -160,6 +160,10 @@ func initLoginBuilder(db *gorm.DB, pb *presets.Builder, ab *activity.ActivityBui
 			return ab.AddCustomizedRecord("reset-password", false, r.Context(), user)
 		}).
 		AfterChangePassword(func(r *http.Request, user interface{}, _ ...interface{}) error {
+			if err := expireAllSessionLogs(user.(*models.User).ID); err != nil {
+				return err
+			}
+
 			return ab.AddCustomizedRecord("change-password", false, r.Context(), user)
 		}).
 		AfterExtendSession(func(r *http.Request, user interface{}, extraVals ...interface{}) error {