1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-23 11:45:38 +01:00

[PM-3513] Show error SSO policy (#2707)

* [PM-3513] Show API error when SSO policy is enforced.
This commit is contained in:
André Bispo 2023-08-18 23:05:52 +01:00 committed by GitHub
parent 7043be67dd
commit e274c04107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ using Bit.App.Utilities;
using Bit.Core; using Bit.Core;
using Bit.Core.Abstractions; using Bit.Core.Abstractions;
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Domain; using Bit.Core.Models.Domain;
using Bit.Core.Models.Response; using Bit.Core.Models.Response;
using Bit.Core.Services; using Bit.Core.Services;
@ -277,6 +278,10 @@ namespace Bit.App.Pages
await HandleLoginCompleteAsync(); await HandleLoginCompleteAsync();
} }
} }
catch (ApiException ex) when (ex.Error?.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
HandleException(ex);
}
catch (Exception ex) catch (Exception ex)
{ {
StartCheckLoginRequestStatus(); StartCheckLoginRequestStatus();
@ -344,16 +349,6 @@ namespace Bit.App.Pages
_requestAccessCode = response.RequestAccessCode; _requestAccessCode = response.RequestAccessCode;
_requestKeyPair = response.RequestKeyPair; _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);
}
} }
} }