mirror of
https://github.com/bitwarden/android.git
synced 2025-01-11 18:57:39 +03:00
[Reset Password] BUG - Update local policies for enforcement (#1565)
* [Reset Password] BUG - Update local policies for enforcement * Updated with blocking sync * add the stuff I forgot to tell vsalucci about * removed the lies I fed vsalucci * remove unnecessary import Co-authored-by: Matt Portune <mportune@bitwarden.com>
This commit is contained in:
parent
9e9e2e12d8
commit
34aba0e168
3 changed files with 23 additions and 4 deletions
|
@ -21,6 +21,7 @@ namespace Bit.App.Pages
|
|||
protected readonly ICryptoService _cryptoService;
|
||||
protected readonly IDeviceActionService _deviceActionService;
|
||||
protected readonly IApiService _apiService;
|
||||
protected readonly ISyncService _syncService;
|
||||
|
||||
private bool _showPassword;
|
||||
private bool _isPolicyInEffect;
|
||||
|
@ -38,6 +39,7 @@ namespace Bit.App.Pages
|
|||
_cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
|
||||
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
|
||||
_apiService = ServiceContainer.Resolve<IApiService>("apiService");
|
||||
_syncService = ServiceContainer.Resolve<ISyncService>("syncService");
|
||||
}
|
||||
|
||||
public bool ShowPassword
|
||||
|
@ -70,9 +72,17 @@ namespace Bit.App.Pages
|
|||
public string ConfirmMasterPassword { get; set; }
|
||||
public string Hint { get; set; }
|
||||
|
||||
public async Task InitAsync()
|
||||
public async Task InitAsync(bool forceSync = false)
|
||||
{
|
||||
await CheckPasswordPolicy();
|
||||
if (forceSync)
|
||||
{
|
||||
var task = Task.Run(async () => await _syncService.FullSyncAsync(true));
|
||||
await task.ContinueWith(async (t) => await CheckPasswordPolicy());
|
||||
}
|
||||
else
|
||||
{
|
||||
await CheckPasswordPolicy();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CheckPasswordPolicy()
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
</ContentPage.ToolbarItems>
|
||||
|
||||
<ScrollView>
|
||||
<StackLayout Spacing="20">
|
||||
<StackLayout
|
||||
x:Name="_mainLayout"
|
||||
Spacing="20">
|
||||
<StackLayout StyleClass="box">
|
||||
<Grid Margin="0, 12, 0, 0"
|
||||
RowSpacing="0"
|
||||
|
@ -50,6 +52,7 @@
|
|||
</Frame>
|
||||
</Grid>
|
||||
<Grid IsVisible="{Binding IsPolicyInEffect}"
|
||||
Margin="0, 12, 0, 0"
|
||||
RowSpacing="0"
|
||||
ColumnSpacing="0">
|
||||
<Grid.RowDefinitions>
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace Bit.App.Pages
|
|||
private readonly IMessagingService _messagingService;
|
||||
private readonly IPlatformUtilsService _platformUtilsService;
|
||||
private readonly UpdateTempPasswordPageViewModel _vm;
|
||||
private readonly string _pageName;
|
||||
|
||||
public UpdateTempPasswordPage()
|
||||
{
|
||||
|
@ -23,8 +24,10 @@ namespace Bit.App.Pages
|
|||
|
||||
// Binding
|
||||
InitializeComponent();
|
||||
_pageName = string.Concat(nameof(UpdateTempPasswordPage), "_", DateTime.UtcNow.Ticks);
|
||||
_vm = BindingContext as UpdateTempPasswordPageViewModel;
|
||||
_vm.Page = this;
|
||||
SetActivityIndicator();
|
||||
|
||||
// Actions Declaration
|
||||
_vm.LogOutAction = () =>
|
||||
|
@ -50,7 +53,10 @@ namespace Bit.App.Pages
|
|||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
await _vm.InitAsync();
|
||||
await LoadOnAppearedAsync(_mainLayout, true, async () =>
|
||||
{
|
||||
await _vm.InitAsync(true);
|
||||
});
|
||||
RequestFocus(_masterPassword);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue