diff options
author | Jack Hay <jack@allspice.io> | 2023-09-01 12:15:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-01 16:15:39 +0000 |
commit | 9881b8a4e24bc81b1acd80b51c5c2541b063149e (patch) | |
tree | 9bf4c5ce0c0d3f11880e6999ad3c2ced798f85eb /routers | |
parent | 04771b5ff79152a47aecce4b2b445daa4a96da33 (diff) | |
download | gitea-9881b8a4e24bc81b1acd80b51c5c2541b063149e.tar.gz gitea-9881b8a4e24bc81b1acd80b51c5c2541b063149e.zip |
Add more descriptive error on forgot password page (#26848)
## Changes
- Forces flashed error to render immediately when forgot password code
is incorrect or has expired.
- Adds a link back to the `forgot_password` page so that the user can
restart the process (in the event that their link has expired)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/auth/password.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/routers/web/auth/password.go b/routers/web/auth/password.go index b34a1d8fce..1432338e70 100644 --- a/routers/web/auth/password.go +++ b/routers/web/auth/password.go @@ -5,6 +5,7 @@ package auth import ( "errors" + "fmt" "net/http" "code.gitea.io/gitea/models/auth" @@ -108,14 +109,14 @@ func commonResetPassword(ctx *context.Context) (*user_model.User, *auth.TwoFacto } if len(code) == 0 { - ctx.Flash.Error(ctx.Tr("auth.invalid_code")) + ctx.Flash.Error(ctx.Tr("auth.invalid_code_forgot_password", fmt.Sprintf("%s/user/forgot_password", setting.AppSubURL)), true) return nil, nil } // Fail early, don't frustrate the user u := user_model.VerifyUserActiveCode(code) if u == nil { - ctx.Flash.Error(ctx.Tr("auth.invalid_code")) + ctx.Flash.Error(ctx.Tr("auth.invalid_code_forgot_password", fmt.Sprintf("%s/user/forgot_password", setting.AppSubURL)), true) return nil, nil } @@ -134,7 +135,7 @@ func commonResetPassword(ctx *context.Context) (*user_model.User, *auth.TwoFacto ctx.Data["user_email"] = u.Email if nil != ctx.Doer && u.ID != ctx.Doer.ID { - ctx.Flash.Error(ctx.Tr("auth.reset_password_wrong_user", ctx.Doer.Email, u.Email)) + ctx.Flash.Error(ctx.Tr("auth.reset_password_wrong_user", ctx.Doer.Email, u.Email), true) return nil, nil } |