mirror of
https://github.com/bitwarden/server.git
synced 2024-11-28 13:15:12 +01:00
Avoid sending "user need confirmation" emails when there are no org admins (#1960)
This commit is contained in:
parent
244a33cdae
commit
de997a2246
@ -1405,10 +1405,15 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
await _organizationUserRepository.ReplaceAsync(orgUser);
|
await _organizationUserRepository.ReplaceAsync(orgUser);
|
||||||
|
|
||||||
await _mailService.SendOrganizationAcceptedEmailAsync(
|
var admins = await _organizationUserRepository.GetManyByMinimumRoleAsync(orgUser.OrganizationId, OrganizationUserType.Admin);
|
||||||
(await _organizationRepository.GetByIdAsync(orgUser.OrganizationId)),
|
var adminEmails = admins.Select(a => a.Email).Distinct().ToList();
|
||||||
user.Email,
|
|
||||||
(await _organizationUserRepository.GetManyByMinimumRoleAsync(orgUser.OrganizationId, OrganizationUserType.Admin)).Select(a => a.Email).Distinct());
|
if (adminEmails.Count > 0)
|
||||||
|
{
|
||||||
|
var organization = await _organizationRepository.GetByIdAsync(orgUser.OrganizationId);
|
||||||
|
await _mailService.SendOrganizationAcceptedEmailAsync(organization, user.Email, adminEmails);
|
||||||
|
}
|
||||||
|
|
||||||
return orgUser;
|
return orgUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user