1
0
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:
André Bispo 2022-11-15 14:17:26 +00:00 committed by GitHub
parent 1b137a8a8a
commit 0992a989d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 3 deletions

View File

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

View File

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

View File

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

View File

@ -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>

View File

@ -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>

View File

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