mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-31 17:47:43 +01:00
[SG-778] Adjust mobile client to handle previously-responded-to passwordless request (#2190)
* [SG-778] Add properties to response model * [SG-778] Add validation for request already answered * [SG-778] Remove unnecessary properties * [SG-778] Remove unnecessary assignments
This commit is contained in:
parent
1b137a8a8a
commit
0992a989d4
@ -205,7 +205,7 @@ namespace Bit.App
|
||||
FingerprintPhrase = loginRequestData.RequestFingerprint,
|
||||
RequestDate = loginRequestData.CreationDate,
|
||||
DeviceType = loginRequestData.RequestDeviceType,
|
||||
Origin = loginRequestData.Origin,
|
||||
Origin = loginRequestData.Origin
|
||||
});
|
||||
await _stateService.SetPasswordlessLoginNotificationAsync(null);
|
||||
_pushNotificationService.DismissLocalNotification(Constants.PasswordlessNotificationId);
|
||||
|
@ -128,7 +128,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
var response = await _authService.GetPasswordlessLoginResponseAsync(_requestId, _requestAccessCode);
|
||||
|
||||
if (!response.RequestApproved)
|
||||
if (response.RequestApproved == null || !response.RequestApproved.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -117,6 +117,14 @@ namespace Bit.App.Pages
|
||||
return;
|
||||
}
|
||||
|
||||
var loginRequestData = await _authService.GetPasswordlessLoginRequestByIdAsync(LoginRequest.Id);
|
||||
if (loginRequestData.RequestApproved.HasValue && loginRequestData.ResponseDate.HasValue)
|
||||
{
|
||||
await _platformUtilsService.ShowDialogAsync(AppResources.ThisRequestIsNoLongerValid);
|
||||
await Page.Navigation.PopModalAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await _deviceActionService.ShowLoadingAsync(AppResources.Loading);
|
||||
await _authService.PasswordlessLoginAsync(LoginRequest.Id, LoginRequest.PubKey, approveRequest);
|
||||
await _deviceActionService.HideLoadingAsync();
|
||||
|
9
src/App/Resources/AppResources.Designer.cs
generated
9
src/App/Resources/AppResources.Designer.cs
generated
@ -5876,6 +5876,15 @@ namespace Bit.App.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to This request is no longer valid.
|
||||
/// </summary>
|
||||
public static string ThisRequestIsNoLongerValid {
|
||||
get {
|
||||
return ResourceManager.GetString("ThisRequestIsNoLongerValid", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 3 days.
|
||||
/// </summary>
|
||||
|
@ -2509,4 +2509,7 @@ Do you want to switch to this account?</value>
|
||||
<data name="ViewAllLoginOptions" xml:space="preserve">
|
||||
<value>View all log in options</value>
|
||||
</data>
|
||||
<data name="ThisRequestIsNoLongerValid" xml:space="preserve">
|
||||
<value>This request is no longer valid</value>
|
||||
</data>
|
||||
</root>
|
||||
|
@ -13,7 +13,8 @@ namespace Bit.Core.Models.Response
|
||||
public string Key { get; set; }
|
||||
public string MasterPasswordHash { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public bool RequestApproved { get; set; }
|
||||
public DateTime? ResponseDate { get; set; }
|
||||
public bool? RequestApproved { get; set; }
|
||||
public string Origin { get; set; }
|
||||
public string RequestAccessCode { get; set; }
|
||||
public Tuple<byte[], byte[]> RequestKeyPair { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user