diff options
Diffstat (limited to 'internal/web/handlers_auth.go')
| -rw-r--r-- | internal/web/handlers_auth.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/web/handlers_auth.go b/internal/web/handlers_auth.go index 7c1d1e8..3030f11 100644 --- a/internal/web/handlers_auth.go +++ b/internal/web/handlers_auth.go @@ -35,7 +35,7 @@ func (s *Server) handleLogin(w http.ResponseWriter, r *http.Request) { next := safeNext(r.FormValue("next")) fail := func() { s.renderStatus(w, r, http.StatusUnauthorized, "auth/login.html", - map[string]any{"error": "Wrong username or password.", "username": username, "next": next}) + map[string]any{"error": s.tr(r, "Wrong username or password."), "username": username, "next": next}) } u, err := s.st.UserByUsername(r.Context(), username) if err != nil { @@ -77,7 +77,7 @@ func (s *Server) handleDashboard(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "/admin/", http.StatusSeeOther) return } - s.plainError(w, http.StatusNotFound, "You have no blog yet. Ask the administrator to create one.") + s.plainError(w, http.StatusNotFound, s.tr(r, "You have no blog yet. Ask the administrator to create one.")) return } s.serverError(w, err) @@ -96,11 +96,11 @@ func (s *Server) handlePassword(w http.ResponseWriter, r *http.Request) { var msg string switch { case !auth.CheckPassword(u.PasswordHash, cur): - msg = "Current password is wrong." + msg = s.tr(r, "Current password is wrong.") case len(pw) < 8: - msg = "New password must be at least 8 characters." + msg = s.tr(r, "New password must be at least 8 characters.") case pw != pw2: - msg = "New passwords do not match." + msg = s.tr(r, "New passwords do not match.") } if msg != "" { s.renderStatus(w, r, http.StatusBadRequest, "dashboard/password.html", map[string]any{"error": msg}) @@ -122,7 +122,7 @@ func (s *Server) handlePassword(w http.ResponseWriter, r *http.Request) { return } auth.SetSessionCookie(w, tok) - redirectOK(w, r, "/dashboard", "Password changed.") + redirectOK(w, r, "/dashboard", s.tr(r, "Password changed.")) } // safeNext only allows local paths as post-login redirect targets. |
