diff --git a/backend/auth.go b/backend/auth.go index 11cc93f..cf0eba8 100644 --- a/backend/auth.go +++ b/backend/auth.go @@ -238,7 +238,7 @@ func (a *AuthService) handleResetConfirm(w http.ResponseWriter, r *http.Request) return } if !a.reset.Confirm(request.Code) { - writeJSONError(w, http.StatusUnauthorized, "Invalid or expired code") + writeJSONError(w, http.StatusUnauthorized, "Invalid or expired reset code.") return } if err := a.db.deleteAllUsers(r.Context()); err != nil { @@ -331,7 +331,7 @@ func (a *AuthService) handleLogin(w http.ResponseWriter, r *http.Request) { return } if user.TOTPEnabled && !sharedauth.VerifyTOTP(user.TOTPSecret, request.TotpToken, time.Now()) { - writeJSONError(w, http.StatusUnauthorized, "two-factor authentication code required") + writeJSONError(w, http.StatusUnauthorized, "Two-factor authentication code required.") return } if err := a.startSession(r.Context(), w, user.ID); err != nil { @@ -382,7 +382,7 @@ func (a *AuthService) handleTOTPEnable(w http.ResponseWriter, r *http.Request, u } secret, _, err := a.db.getTOTPState(r.Context(), user.ID) if err != nil || !sharedauth.VerifyTOTP(secret, request.Token, time.Now()) { - writeJSONError(w, http.StatusUnauthorized, "invalid two-factor authentication code") + writeJSONError(w, http.StatusUnauthorized, "Invalid authenticator code.") return } if err := a.db.enableTOTP(r.Context(), user.ID); err != nil { @@ -400,7 +400,7 @@ func (a *AuthService) handleTOTPDisable(w http.ResponseWriter, r *http.Request, } secret, enabled, err := a.db.getTOTPState(r.Context(), user.ID) if err != nil || !enabled || !sharedauth.VerifyTOTP(secret, request.Token, time.Now()) { - writeJSONError(w, http.StatusUnauthorized, "invalid two-factor authentication code") + writeJSONError(w, http.StatusUnauthorized, "Invalid authenticator code.") return } if err := a.db.disableTOTP(r.Context(), user.ID); err != nil { @@ -579,7 +579,7 @@ func (a *AuthService) handleUsers(w http.ResponseWriter, r *http.Request, actor } created, err := a.db.createManagedUser(r.Context(), username, email, string(hash), role) if err != nil { - writeJSONError(w, http.StatusConflict, "Username or email is already in use") + writeJSONError(w, http.StatusConflict, "Username or email is already in use.") return } writeJSON(w, http.StatusCreated, managedUserView(*created)) @@ -652,7 +652,7 @@ func (a *AuthService) handleUser(w http.ResponseWriter, r *http.Request, actor * role = string(sharedauth.NormalizeRole(*request.Role)) } if err := a.db.updateManagedUser(r.Context(), id, username, email, passwordHash, role); err != nil { - writeJSONError(w, http.StatusConflict, "Username or email is already in use") + writeJSONError(w, http.StatusConflict, "Username or email is already in use.") return } writeJSON(w, http.StatusOK, map[string]bool{"ok": true})