1
0
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:
Thomas Rittson
2021-02-26 08:11:58 +10:00
committed by GitHub
parent b21c9042ca
commit 3850f0e400
4 changed files with 42 additions and 5 deletions

View File

@ -10,5 +10,6 @@ namespace Bit.Core.Models.Data
{
public string GrantorEmail { get; set; }
public string GranteeName { get; set; }
public string GranteeEmail { get; set; }
}
}

View File

@ -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);
}
}

View File

@ -6,6 +6,7 @@ BEGIN
SELECT
EA.*,
Grantee.Name as GranteeName,
Grantee.Email as GranteeEmail,
Grantor.Email as GrantorEmail
FROM
[dbo].[EmergencyAccess] EA