Skip to content

Commit

Permalink
[PM-3513] Show error SSO policy (#2707)
Browse files Browse the repository at this point in the history
* [PM-3513] Show API error when SSO policy is enforced.

(cherry picked from commit e274c04)
  • Loading branch information
andrebispo5 committed Aug 18, 2023
1 parent a7bf0e2 commit 2841a0e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/App/Pages/Accounts/LoginPasswordlessRequestViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Bit.Core;
using Bit.Core.Abstractions;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Domain;
using Bit.Core.Models.Response;
using Bit.Core.Services;
Expand Down Expand Up @@ -277,6 +278,10 @@ private async Task CheckLoginRequestStatus()
await HandleLoginCompleteAsync();
}
}
catch (ApiException ex) when (ex.Error?.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
HandleException(ex);
}
catch (Exception ex)
{
StartCheckLoginRequestStatus();
Expand Down Expand Up @@ -344,16 +349,6 @@ private async Task HandlePasswordlessLoginAsync(PasswordlessLoginResponse respon
_requestAccessCode = response.RequestAccessCode;
_requestKeyPair = response.RequestKeyPair;
}

private void HandleException(Exception ex)
{
Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
{
await _deviceActionService.HideLoadingAsync();
await _platformUtilsService.ShowDialogAsync(AppResources.GenericErrorMessage);
}).FireAndForget();
_logger.Exception(ex);
}
}
}

0 comments on commit 2841a0e

Please sign in to comment.