From d17db93fbf52360ece6bdc2803d2ae593e58ad0b Mon Sep 17 00:00:00 2001 From: voltagex Date: Mon, 7 Oct 2024 16:11:07 +0000 Subject: [PATCH] i18n: improve 'Verify' error message, stopgap for #2809 (#5479) Signed-off-by: Adam Baxter Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5479 Reviewed-by: Otto Co-authored-by: voltagex Co-committed-by: voltagex --- options/locale/locale_en-US.ini | 2 ++ routers/web/web.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index b84cb42b85..a4e653b6ba 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -438,6 +438,8 @@ reset_password_wrong_user = You are signed in as %s, but the account recovery li password_too_short = Password length cannot be less than %d characters. non_local_account = Non-local users cannot update their password through the Forgejo web interface. verify = Verify +;As https://codeberg.org/forgejo/forgejo/issues/2809 progresses, please update this error message if possible +unauthorized_credentials = Credentials are incorrect or have expired. Retry your command or see %s for more information scratch_code = Scratch code use_scratch_code = Use a scratch code twofa_scratch_used = You have used your scratch code. You have been redirected to the two-factor settings page so you may remove your device enrollment or generate a new scratch code. diff --git a/routers/web/web.go b/routers/web/web.go index 39116b882d..c268f7224d 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -122,7 +122,7 @@ func webAuth(authMethod auth_service.Method) func(*context.Context) { ar, err := common.AuthShared(ctx.Base, ctx.Session, authMethod) if err != nil { log.Error("Failed to verify user: %v", err) - ctx.Error(http.StatusUnauthorized, "Verify") + ctx.Error(http.StatusUnauthorized, ctx.Locale.TrString("auth.unauthorized_credentials", "https://codeberg.org/forgejo/forgejo/issues/2809")) return } ctx.Doer = ar.Doer