Browse Source

Invalidate all sessions after password reset

Charles Shen 1 year ago
parent
commit
8c98097816
1 changed files with 3 additions and 0 deletions
  1. 3 0
      example/admin/auth.go

+ 3 - 0
example/admin/auth.go

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