Mention unset password on failed login

(when it applies)
This commit is contained in:
Matt Baer 2020-04-22 09:26:42 -04:00
parent cf3d5588c2
commit fd97539f85
1 changed files with 3 additions and 0 deletions

View File

@ -489,6 +489,9 @@ func login(app *App, w http.ResponseWriter, r *http.Request) error {
return impart.HTTPError{http.StatusPreconditionFailed, "This user never added a password or email address. Please contact us for help."} return impart.HTTPError{http.StatusPreconditionFailed, "This user never added a password or email address. Please contact us for help."}
} }
} }
if len(u.HashedPass) == 0 {
return impart.HTTPError{http.StatusUnauthorized, "This user never set a password. Perhaps try logging in via OAuth?"}
}
if !auth.Authenticated(u.HashedPass, []byte(signin.Pass)) { if !auth.Authenticated(u.HashedPass, []byte(signin.Pass)) {
return impart.HTTPError{http.StatusUnauthorized, "Incorrect password."} return impart.HTTPError{http.StatusUnauthorized, "Incorrect password."}
} }