From c251b950d1212436de43ff18149f04652ee8db74 Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Thu, 28 Apr 2022 10:51:13 -0300 Subject: [PATCH] PS-77 Updated two-factor email request to include the device identifier to check whether to send the 2fa email because of a new device (#1895) --- src/App/Pages/Accounts/TwoFactorPageViewModel.cs | 5 ++++- src/Core/Models/Request/TwoFactorEmailRequest.cs | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs index 15de50f51..7de82e1f8 100644 --- a/src/App/Pages/Accounts/TwoFactorPageViewModel.cs +++ b/src/App/Pages/Accounts/TwoFactorPageViewModel.cs @@ -29,6 +29,7 @@ namespace Bit.App.Pages private readonly IBroadcasterService _broadcasterService; private readonly IStateService _stateService; private readonly II18nService _i18nService; + private readonly IAppIdService _appIdService; private TwoFactorProviderType? _selectedProviderType; private string _totpInstruction; @@ -49,6 +50,7 @@ namespace Bit.App.Pages _broadcasterService = ServiceContainer.Resolve("broadcasterService"); _stateService = ServiceContainer.Resolve("stateService"); _i18nService = ServiceContainer.Resolve("i18nService"); + _appIdService = ServiceContainer.Resolve("appIdService"); PageTitle = AppResources.TwoStepLogin; SubmitCommand = new Command(async () => await SubmitAsync()); @@ -380,7 +382,8 @@ namespace Bit.App.Pages var request = new TwoFactorEmailRequest { Email = _authService.Email, - MasterPasswordHash = _authService.MasterPasswordHash + MasterPasswordHash = _authService.MasterPasswordHash, + DeviceIdentifier = await _appIdService.GetAppIdAsync() }; await _apiService.PostTwoFactorEmailAsync(request); if (showLoading) diff --git a/src/Core/Models/Request/TwoFactorEmailRequest.cs b/src/Core/Models/Request/TwoFactorEmailRequest.cs index 3446df586..2b5784099 100644 --- a/src/Core/Models/Request/TwoFactorEmailRequest.cs +++ b/src/Core/Models/Request/TwoFactorEmailRequest.cs @@ -4,5 +4,6 @@ { public string Email { get; set; } public string MasterPasswordHash { get; set; } + public string DeviceIdentifier { get; set; } } }