mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
Ac/pm 17449/add managed user validation to email token (#5437)
This commit is contained in:
@ -149,6 +149,12 @@ public class AccountsController : Controller
|
||||
throw new BadRequestException("MasterPasswordHash", "Invalid password.");
|
||||
}
|
||||
|
||||
var managedUserValidationResult = await _userService.ValidateManagedUserDomainAsync(user, model.NewEmail);
|
||||
|
||||
if (!managedUserValidationResult.Succeeded)
|
||||
{
|
||||
throw new BadRequestException(managedUserValidationResult.Errors);
|
||||
}
|
||||
|
||||
await _userService.InitiateEmailChangeAsync(user, model.NewEmail);
|
||||
}
|
||||
@ -167,7 +173,6 @@ public class AccountsController : Controller
|
||||
throw new BadRequestException("You cannot change your email when using Key Connector.");
|
||||
}
|
||||
|
||||
|
||||
var result = await _userService.ChangeEmailAsync(user, model.MasterPasswordHash, model.NewEmail,
|
||||
model.NewMasterPasswordHash, model.Token, model.Key);
|
||||
if (result.Succeeded)
|
||||
|
Reference in New Issue
Block a user