mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
Fix empty grantee or grantor names in emergency access emails (#1162)
* Fix empty grantee or grantor names in emails * Add migrator dbscript for changes to ReadToNotify
This commit is contained in:
@ -10,5 +10,6 @@ namespace Bit.Core.Models.Data
|
||||
{
|
||||
public string GrantorEmail { get; set; }
|
||||
public string GranteeName { get; set; }
|
||||
public string GranteeEmail { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -313,8 +313,10 @@ namespace Bit.Core.Services
|
||||
var ea = notify.ToEmergencyAccess();
|
||||
ea.LastNotificationDate = DateTime.UtcNow;
|
||||
await _emergencyAccessRepository.ReplaceAsync(ea);
|
||||
|
||||
await _mailService.SendEmergencyAccessRecoveryReminder(ea, notify.GranteeName, notify.GrantorEmail);
|
||||
|
||||
var granteeNameOrEmail = string.IsNullOrWhiteSpace(notify.GranteeName) ? notify.GranteeEmail : notify.GranteeName;
|
||||
|
||||
await _mailService.SendEmergencyAccessRecoveryReminder(ea, granteeNameOrEmail, notify.GrantorEmail);
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,9 +329,12 @@ namespace Bit.Core.Services
|
||||
var ea = details.ToEmergencyAccess();
|
||||
ea.Status = EmergencyAccessStatusType.RecoveryApproved;
|
||||
await _emergencyAccessRepository.ReplaceAsync(ea);
|
||||
|
||||
await _mailService.SendEmergencyAccessRecoveryApproved(ea, details.GrantorName, details.GranteeEmail);
|
||||
await _mailService.SendEmergencyAccessRecoveryTimedOut(ea, details.GranteeName, details.GrantorEmail);
|
||||
|
||||
var grantorNameOrEmail = string.IsNullOrWhiteSpace(details.GrantorName) ? details.GrantorEmail : details.GrantorName;
|
||||
var granteeNameOrEmail = string.IsNullOrWhiteSpace(details.GranteeName) ? details.GranteeEmail : details.GranteeName;
|
||||
|
||||
await _mailService.SendEmergencyAccessRecoveryApproved(ea, grantorNameOrEmail, details.GranteeEmail);
|
||||
await _mailService.SendEmergencyAccessRecoveryTimedOut(ea, granteeNameOrEmail, details.GrantorEmail);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ BEGIN
|
||||
SELECT
|
||||
EA.*,
|
||||
Grantee.Name as GranteeName,
|
||||
Grantee.Email as GranteeEmail,
|
||||
Grantor.Email as GrantorEmail
|
||||
FROM
|
||||
[dbo].[EmergencyAccess] EA
|
||||
|
Reference in New Issue
Block a user