Browse Source

Respond with 'Email sent' regardless of whether a match occurred

Charles Shen 1 year ago
parent
commit
71d31d9c31
1 changed files with 2 additions and 6 deletions
  1. 2 6
      login/builder.go

+ 2 - 6
login/builder.go

@@ -964,12 +964,8 @@ func (b *Builder) sendResetPasswordLink(w http.ResponseWriter, r *http.Request)
 
 	u, err := b.userModel.(UserPasser).FindUser(b.db, b.newUserObject(), account)
 	if err != nil {
-		if err == gorm.ErrRecordNotFound {
-			setFailCodeFlash(w, FailCodeUserNotFound)
-			setWrongForgetPasswordInputFlash(w, WrongForgetPasswordInputFlash{
-				Account: account,
-			})
-			http.Redirect(w, r, failRedirectURL, http.StatusFound)
+		if errors.Is(err, gorm.ErrRecordNotFound) {
+			http.Redirect(w, r, fmt.Sprintf("%s?a=%s", b.resetPasswordLinkSentPageURL, account), http.StatusFound)
 			return
 		}
 		panic(err)