aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-02-25 21:39:52 +0800
committerGitHub <noreply@github.com>2017-02-25 21:39:52 +0800
commit8894f856de70c5c4080f39f05ff0283971faf856 (patch)
treee270c45c57071c6bdf6e645fe9f5d21c14e334bf /routers
parentd4a7040c7f12a1fbf12bdc08483baf5838f1bfb9 (diff)
downloadgitea-8894f856de70c5c4080f39f05ff0283971faf856.tar.gz
gitea-8894f856de70c5c4080f39f05ff0283971faf856.zip
fix 500 when change user setting email to an exist email (#1039)
Diffstat (limited to 'routers')
-rw-r--r--routers/user/setting.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/user/setting.go b/routers/user/setting.go
index de5a1baca4..16ba2bb050 100644
--- a/routers/user/setting.go
+++ b/routers/user/setting.go
@@ -105,6 +105,11 @@ func SettingsPost(ctx *context.Context, form auth.UpdateProfileForm) {
ctx.User.Website = form.Website
ctx.User.Location = form.Location
if err := models.UpdateUser(ctx.User); err != nil {
+ if _, ok := err.(models.ErrEmailAlreadyUsed); ok {
+ ctx.Flash.Error(ctx.Tr("form.email_been_used"))
+ ctx.Redirect(setting.AppSubURL + "/user/settings")
+ return
+ }
ctx.Handle(500, "UpdateUser", err)
return
}