From 539f8fe5b51c5a59b741b9d04fdb8aa9e80e89e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bispo?= Date: Wed, 12 Oct 2022 15:55:38 +0100 Subject: [PATCH] [SG-690] Timeout fix (#2129) [SG-690] Updated server times to utc --- src/App/App.xaml.cs | 2 +- src/App/Pages/Accounts/LoginPasswordlessViewModel.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index b78085a13..986651270 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -191,7 +191,7 @@ namespace Bit.App }); await _stateService.SetPasswordlessLoginNotificationAsync(null); _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))); } diff --git a/src/App/Pages/Accounts/LoginPasswordlessViewModel.cs b/src/App/Pages/Accounts/LoginPasswordlessViewModel.cs index 1a5ba8a83..1ca09b540 100644 --- a/src/App/Pages/Accounts/LoginPasswordlessViewModel.cs +++ b/src/App/Pages/Accounts/LoginPasswordlessViewModel.cs @@ -100,7 +100,7 @@ namespace Bit.App.Pages private async Task UpdateRequestTime() { TriggerPropertyChanged(nameof(TimeOfRequestText)); - if (DateTime.UtcNow > LoginRequest?.RequestDate.AddMinutes(Constants.PasswordlessNotificationTimeoutInMinutes)) + if (DateTime.UtcNow > LoginRequest?.RequestDate.ToUniversalTime().AddMinutes(Constants.PasswordlessNotificationTimeoutInMinutes)) { StopRequestTimeUpdater(); await _platformUtilsService.ShowDialogAsync(AppResources.LoginRequestHasAlreadyExpired); @@ -110,7 +110,7 @@ namespace Bit.App.Pages 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 Page.Navigation.PopModalAsync();