1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

[PM-17645] : update email for new email multi factor tokens (#5428)

* feat(newDeviceVerification) : Initial update to email

* fix : email copying over extra whitespace when using keyboard short cuts

* test : Fixing tests for new device verificaiton email format
This commit is contained in:
Ike
2025-02-21 11:12:31 -05:00
committed by GitHub
parent b66f255c5c
commit b00f11fc43
14 changed files with 214 additions and 38 deletions

View File

@ -79,7 +79,7 @@ public class DeviceValidator(
BuildDeviceErrorResult(validationResult);
if (validationResult == DeviceValidationResultType.NewDeviceVerificationRequired)
{
await _userService.SendOTPAsync(context.User);
await _userService.SendNewDeviceVerificationEmailAsync(context.User);
}
return false;
}
@ -163,6 +163,14 @@ public class DeviceValidator(
return DeviceValidationResultType.NewDeviceVerificationRequired;
}
/// <summary>
/// Sends an email whenever the user logs in from a new device. Will not send to a user who's account
/// is less than 10 minutes old. We assume an account that is less than 10 minutes old is new and does
/// not need an email stating they just logged in.
/// </summary>
/// <param name="user">user logging in</param>
/// <param name="requestDevice">current device being approved to login</param>
/// <returns>void</returns>
private async Task SendNewDeviceLoginEmail(User user, Device requestDevice)
{
// Ensure that the user doesn't receive a "new device" email on the first login