mirror of
https://github.com/bitwarden/server
synced 2026-01-07 02:53:38 +00:00
Ac/pm 17449/add managed user validation to email token (#5437)
This commit is contained in:
@@ -136,6 +136,16 @@ public interface IUserService
|
||||
/// </returns>
|
||||
Task<bool> IsManagedByAnyOrganizationAsync(Guid userId);
|
||||
|
||||
/// <summary>
|
||||
/// Verify whether the new email domain meets the requirements for managed users.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// IdentityResult
|
||||
/// </returns>
|
||||
Task<IdentityResult> ValidateManagedUserDomainAsync(User user, string newEmail);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the organizations that manage the user.
|
||||
/// </summary>
|
||||
|
||||
@@ -545,7 +545,7 @@ public class UserService : UserManager<User>, IUserService, IDisposable
|
||||
return IdentityResult.Failed(_identityErrorDescriber.PasswordMismatch());
|
||||
}
|
||||
|
||||
var managedUserValidationResult = await ValidateManagedUserAsync(user, newEmail);
|
||||
var managedUserValidationResult = await ValidateManagedUserDomainAsync(user, newEmail);
|
||||
|
||||
if (!managedUserValidationResult.Succeeded)
|
||||
{
|
||||
@@ -617,7 +617,7 @@ public class UserService : UserManager<User>, IUserService, IDisposable
|
||||
return IdentityResult.Success;
|
||||
}
|
||||
|
||||
private async Task<IdentityResult> ValidateManagedUserAsync(User user, string newEmail)
|
||||
public async Task<IdentityResult> ValidateManagedUserDomainAsync(User user, string newEmail)
|
||||
{
|
||||
var managingOrganizations = await GetOrganizationsManagingUserAsync(user.Id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user