Fix update user (#18878)

tokarchuk/v1.17
Lunny Xiao 3 years ago committed by GitHub
parent f1b1472632
commit 6621710deb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      models/user/user.go

@ -868,15 +868,16 @@ func updateUser(ctx context.Context, u *User, changePrimaryEmail bool, cols ...s
}
if !primaryEmailExist {
_, err = e.Insert(&EmailAddress{
if _, err := e.Insert(&EmailAddress{
Email: u.Email,
UID: u.ID,
IsActivated: true,
IsPrimary: true,
})
}); err != nil {
return err
}
}
}
if len(cols) == 0 {
_, err = e.ID(u.ID).AllCols().Update(u)

Loading…
Cancel
Save