Browse Source

#282

tags/v1.21.12.1
ychao_1983 4 years ago
parent
commit
8383329b15
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      routers/user/setting/account.go

+ 6
- 0
routers/user/setting/account.go View File

@@ -80,6 +80,12 @@ func EmailPost(ctx *context.Context, form auth.AddEmailForm) {
// Make emailaddress primary. // Make emailaddress primary.
if ctx.Query("_method") == "PRIMARY" { if ctx.Query("_method") == "PRIMARY" {
if err := models.MakeEmailPrimary(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil { 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) ctx.ServerError("MakeEmailPrimary", err)
return return
} }


Loading…
Cancel
Save