diff --git a/routers/user/setting/account.go b/routers/user/setting/account.go index 27f0bf1c8..6165bfc5b 100644 --- a/routers/user/setting/account.go +++ b/routers/user/setting/account.go @@ -80,6 +80,12 @@ func EmailPost(ctx *context.Context, form auth.AddEmailForm) { // Make emailaddress primary. if ctx.Query("_method") == "PRIMARY" { if err := models.MakeEmailPrimary(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil { + if _, ok := err.(models.ErrEmailAlreadyUsed); ok { + ctx.Flash.Error(ctx.Tr("form.email_been_used")) + ctx.Redirect(setting.AppSubURL + "/user/settings/account") + return + } + ctx.ServerError("MakeEmailPrimary", err) return }