mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-25 12:05:59 +01:00
[SSO Auto Enroll] Auto Enroll status retrieval (#1540)
* [SSO Auto Enroll] Auto Enroll status retrieval * Updated object property to match server
This commit is contained in:
parent
14b51b1a7f
commit
024d9380c9
@ -97,12 +97,21 @@ namespace Bit.App.Pages
|
||||
public async Task InitAsync()
|
||||
{
|
||||
await CheckPasswordPolicy();
|
||||
|
||||
var org = await _userService.GetOrganizationByIdentifierAsync(OrgIdentifier);
|
||||
OrgId = org?.Id;
|
||||
var policyList = await _policyService.GetAll(PolicyType.ResetPassword);
|
||||
var policyResult = _policyService.GetResetPasswordPolicyOptions(policyList, OrgId);
|
||||
ResetPasswordAutoEnroll = policyResult.Item2 && policyResult.Item1.AutoEnrollEnabled;
|
||||
|
||||
try
|
||||
{
|
||||
var response = await _apiService.GetOrganizationAutoEnrollStatusAsync(OrgIdentifier);
|
||||
OrgId = response.Id;
|
||||
ResetPasswordAutoEnroll = response.ResetPasswordEnrolled;
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
if (e?.Error != null)
|
||||
{
|
||||
await _platformUtilsService.ShowDialogAsync(e.Error.GetSingleMessage(),
|
||||
AppResources.AnErrorHasOccurred);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SubmitAsync()
|
||||
|
@ -59,6 +59,7 @@ namespace Bit.Core.Abstractions
|
||||
Task PutDeviceTokenAsync(string identifier, DeviceTokenRequest request);
|
||||
Task PostEventsCollectAsync(IEnumerable<EventRequest> request);
|
||||
Task<OrganizationKeysResponse> GetOrganizationKeysAsync(string id);
|
||||
Task<OrganizationAutoEnrollStatusResponse> GetOrganizationAutoEnrollStatusAsync(string identifier);
|
||||
Task PutOrganizationUserResetPasswordEnrollmentAsync(string orgId, string userId,
|
||||
OrganizationUserResetPasswordEnrollmentRequest request);
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
namespace Bit.Core.Models.Response
|
||||
{
|
||||
public class OrganizationAutoEnrollStatusResponse
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public bool ResetPasswordEnrolled { get; set; }
|
||||
}
|
||||
}
|
@ -410,6 +410,12 @@ namespace Bit.Core.Services
|
||||
{
|
||||
return SendAsync<object, OrganizationKeysResponse>(HttpMethod.Get, $"/organizations/{id}/keys", null, true, true);
|
||||
}
|
||||
|
||||
public Task<OrganizationAutoEnrollStatusResponse> GetOrganizationAutoEnrollStatusAsync(string identifier)
|
||||
{
|
||||
return SendAsync<object, OrganizationAutoEnrollStatusResponse>(HttpMethod.Get,
|
||||
$"/organizations/{identifier}/auto-enroll-status", null, true, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user