diff options
author | Unknwon <u@gogs.io> | 2016-03-14 16:44:05 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-03-14 16:44:05 -0400 |
commit | 8966f5635da0caf2c1f4034a61279b614da51e41 (patch) | |
tree | 448d16fae7e31ddfbffb523a15e6ef8a22d21590 | |
parent | 9bd9ad420582a7a34d18011847bb789f64271b1f (diff) | |
parent | 63e21c146aa3fda2715d55235d54dfb95a9077cc (diff) |
Merge pull request #2823 from zacheryph/feature/local-only-password-reset
Prevent `Forgot Password` for non local users
-rw-r--r-- | conf/locale/locale_en-US.ini | 1 | ||||
-rw-r--r-- | routers/user/auth.go | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index eed87430..621ba4f7 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -157,6 +157,7 @@ reset_password = Reset Your Password invalid_code = Sorry, your confirmation code has expired or not valid. reset_password_helper = Click here to reset your password password_too_short = Password length cannot be less then 6. +non_local_account = Non-local accounts cannot change passwords through Gogs. [mail] activate_account = Please activate your account diff --git a/routers/user/auth.go b/routers/user/auth.go index 646b8783..9b48357a 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -343,6 +343,12 @@ func ForgotPasswdPost(ctx *context.Context) { return } + if !u.IsLocal() { + ctx.Data["Err_Email"] = true + ctx.RenderWithErr(ctx.Tr("auth.non_local_account"), FORGOT_PASSWORD, nil) + return + } + if ctx.Cache.IsExist("MailResendLimit_" + u.LowerName) { ctx.Data["ResendLimited"] = true ctx.HTML(200, FORGOT_PASSWORD) |