diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini
index eed874305b..621ba4f70b 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 646b878396..9b48357aaa 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)