mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(user): change username (#1502)
* fix(user): change username * fix(user): api client error improvements * fix(user): api client error improvements
This commit is contained in:
parent
da53230077
commit
5857945e71
3 changed files with 18 additions and 14 deletions
|
@ -134,12 +134,14 @@ func (s *service) UpdateUser(ctx context.Context, req domain.UpdateUserRequest)
|
|||
return errors.Errorf("invalid login: %s", req.UsernameCurrent)
|
||||
}
|
||||
|
||||
hashed, err := s.CreateHash(req.PasswordNew)
|
||||
if err != nil {
|
||||
return errors.New("failed to hash password")
|
||||
}
|
||||
if req.PasswordNew != "" {
|
||||
hashed, err := s.CreateHash(req.PasswordNew)
|
||||
if err != nil {
|
||||
return errors.New("failed to hash password")
|
||||
}
|
||||
|
||||
req.PasswordNewHash = hashed
|
||||
req.PasswordNewHash = hashed
|
||||
}
|
||||
|
||||
if err := s.userSvc.Update(ctx, req); err != nil {
|
||||
s.log.Error().Err(err).Msgf("could not change password for user: %s", req.UsernameCurrent)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue