[SG-690] Timeout fix (#2129)

[SG-690] Updated server times to utc
This commit is contained in:
André Bispo 2022-10-12 15:55:38 +01:00 committed by GitHub
parent 569922805f
commit 539f8fe5b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -191,7 +191,7 @@ namespace Bit.App
}); });
await _stateService.SetPasswordlessLoginNotificationAsync(null); await _stateService.SetPasswordlessLoginNotificationAsync(null);
_pushNotificationService.DismissLocalNotification(Constants.PasswordlessNotificationId); _pushNotificationService.DismissLocalNotification(Constants.PasswordlessNotificationId);
if (loginRequestData.CreationDate.AddMinutes(Constants.PasswordlessNotificationTimeoutInMinutes) > DateTime.UtcNow) if (loginRequestData.CreationDate.ToUniversalTime().AddMinutes(Constants.PasswordlessNotificationTimeoutInMinutes) > DateTime.UtcNow)
{ {
await Device.InvokeOnMainThreadAsync(() => Application.Current.MainPage.Navigation.PushModalAsync(new NavigationPage(page))); await Device.InvokeOnMainThreadAsync(() => Application.Current.MainPage.Navigation.PushModalAsync(new NavigationPage(page)));
} }

View file

@ -100,7 +100,7 @@ namespace Bit.App.Pages
private async Task UpdateRequestTime() private async Task UpdateRequestTime()
{ {
TriggerPropertyChanged(nameof(TimeOfRequestText)); TriggerPropertyChanged(nameof(TimeOfRequestText));
if (DateTime.UtcNow > LoginRequest?.RequestDate.AddMinutes(Constants.PasswordlessNotificationTimeoutInMinutes)) if (DateTime.UtcNow > LoginRequest?.RequestDate.ToUniversalTime().AddMinutes(Constants.PasswordlessNotificationTimeoutInMinutes))
{ {
StopRequestTimeUpdater(); StopRequestTimeUpdater();
await _platformUtilsService.ShowDialogAsync(AppResources.LoginRequestHasAlreadyExpired); await _platformUtilsService.ShowDialogAsync(AppResources.LoginRequestHasAlreadyExpired);
@ -110,7 +110,7 @@ namespace Bit.App.Pages
private async Task PasswordlessLoginAsync(bool approveRequest) private async Task PasswordlessLoginAsync(bool approveRequest)
{ {
if (LoginRequest.RequestDate.AddMinutes(Constants.PasswordlessNotificationTimeoutInMinutes) <= DateTime.UtcNow) if (LoginRequest.RequestDate.ToUniversalTime().AddMinutes(Constants.PasswordlessNotificationTimeoutInMinutes) <= DateTime.UtcNow)
{ {
await _platformUtilsService.ShowDialogAsync(AppResources.LoginRequestHasAlreadyExpired); await _platformUtilsService.ShowDialogAsync(AppResources.LoginRequestHasAlreadyExpired);
await Page.Navigation.PopModalAsync(); await Page.Navigation.PopModalAsync();