Passwordless login 2FA not working (#2289)

* [SG-174] Fix 2FA passwordless login

* [SG-982] Enable login with device
This commit is contained in:
André Bispo 2023-01-16 18:25:44 +00:00 committed by GitHub
parent 2b8547878a
commit f15fd246a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -149,8 +149,7 @@ namespace Bit.App.Pages
Email = await _stateService.GetRememberedEmailAsync();
}
var deviceIdentifier = await _appIdService.GetAppIdAsync();
// TODO uncomment to enable login with device
//IsKnownDevice = await _apiService.GetKnownDeviceAsync(Email, deviceIdentifier);
IsKnownDevice = await _apiService.GetKnownDeviceAsync(Email, deviceIdentifier);
CanRemoveAccount = await _stateService.GetActiveUserEmailAsync() != Email;
await _deviceActionService.HideLoadingAsync();
}

View file

@ -106,6 +106,7 @@ namespace Bit.Core.Services
public string CaptchaToken { get; set; }
public string MasterPasswordHash { get; set; }
public string LocalMasterPasswordHash { get; set; }
public string AuthRequestId { get; set; }
public string Code { get; set; }
public string CodeVerifier { get; set; }
public string SsoRedirectUrl { get; set; }
@ -163,7 +164,7 @@ namespace Bit.Core.Services
CaptchaToken = captchaToken;
}
return LogInHelperAsync(Email, MasterPasswordHash, LocalMasterPasswordHash, Code, CodeVerifier, SsoRedirectUrl, _key,
twoFactorProvider, twoFactorToken, remember, CaptchaToken);
twoFactorProvider, twoFactorToken, remember, CaptchaToken, authRequestId: AuthRequestId);
}
public async Task<AuthResult> LogInCompleteAsync(string email, string masterPassword,
@ -328,12 +329,12 @@ namespace Bit.Core.Services
if (twoFactorToken != null && twoFactorProvider != null)
{
request = new TokenRequest(emailPassword, codeCodeVerifier, twoFactorProvider, twoFactorToken, remember,
captchaToken, deviceRequest);
captchaToken, deviceRequest, authRequestId);
}
else if (storedTwoFactorToken != null)
{
request = new TokenRequest(emailPassword, codeCodeVerifier, TwoFactorProviderType.Remember,
storedTwoFactorToken, false, captchaToken, deviceRequest);
storedTwoFactorToken, false, captchaToken, deviceRequest, authRequestId);
}
else if (authRequestId != null)
{
@ -359,6 +360,7 @@ namespace Bit.Core.Services
Email = email;
MasterPasswordHash = hashedPassword;
LocalMasterPasswordHash = localHashedPassword;
AuthRequestId = authRequestId;
Code = code;
CodeVerifier = codeVerifier;
SsoRedirectUrl = redirectUrl;
@ -481,6 +483,7 @@ namespace Bit.Core.Services
Email = null;
CaptchaToken = null;
MasterPasswordHash = null;
AuthRequestId = null;
Code = null;
CodeVerifier = null;
SsoRedirectUrl = null;