fix: ensure exists check only matches if it is a different account id
This commit is contained in:
parent
080bef354d
commit
3473551f6c
|
@ -279,8 +279,8 @@ func (s AccountServiceDefault) UpdateAccountName(userId uint, firstName string,
|
|||
}
|
||||
|
||||
func (s AccountServiceDefault) UpdateAccountEmail(userId uint, email string, password string) error {
|
||||
exists, _, err := s.EmailExists(email)
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) || exists {
|
||||
exists, euser, err := s.EmailExists(email)
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) || (exists && euser.ID != userId) {
|
||||
return NewAccountError(ErrKeyEmailAlreadyExists, nil)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue