mirror of
https://github.com/bitwarden/mobile
synced 2025-12-21 10:43:22 +00: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:
@@ -21,6 +21,7 @@ namespace Bit.App.Pages
|
|||||||
protected readonly ICryptoService _cryptoService;
|
protected readonly ICryptoService _cryptoService;
|
||||||
protected readonly IDeviceActionService _deviceActionService;
|
protected readonly IDeviceActionService _deviceActionService;
|
||||||
protected readonly IApiService _apiService;
|
protected readonly IApiService _apiService;
|
||||||
|
protected readonly ISyncService _syncService;
|
||||||
|
|
||||||
private bool _showPassword;
|
private bool _showPassword;
|
||||||
private bool _isPolicyInEffect;
|
private bool _isPolicyInEffect;
|
||||||
@@ -38,6 +39,7 @@ namespace Bit.App.Pages
|
|||||||
_cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
|
_cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
|
||||||
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
|
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
|
||||||
_apiService = ServiceContainer.Resolve<IApiService>("apiService");
|
_apiService = ServiceContainer.Resolve<IApiService>("apiService");
|
||||||
|
_syncService = ServiceContainer.Resolve<ISyncService>("syncService");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ShowPassword
|
public bool ShowPassword
|
||||||
@@ -70,10 +72,18 @@ namespace Bit.App.Pages
|
|||||||
public string ConfirmMasterPassword { get; set; }
|
public string ConfirmMasterPassword { get; set; }
|
||||||
public string Hint { get; set; }
|
public string Hint { get; set; }
|
||||||
|
|
||||||
public async Task InitAsync()
|
public async Task InitAsync(bool forceSync = false)
|
||||||
|
{
|
||||||
|
if (forceSync)
|
||||||
|
{
|
||||||
|
var task = Task.Run(async () => await _syncService.FullSyncAsync(true));
|
||||||
|
await task.ContinueWith(async (t) => await CheckPasswordPolicy());
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
await CheckPasswordPolicy();
|
await CheckPasswordPolicy();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task CheckPasswordPolicy()
|
private async Task CheckPasswordPolicy()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,9 @@
|
|||||||
</ContentPage.ToolbarItems>
|
</ContentPage.ToolbarItems>
|
||||||
|
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<StackLayout Spacing="20">
|
<StackLayout
|
||||||
|
x:Name="_mainLayout"
|
||||||
|
Spacing="20">
|
||||||
<StackLayout StyleClass="box">
|
<StackLayout StyleClass="box">
|
||||||
<Grid Margin="0, 12, 0, 0"
|
<Grid Margin="0, 12, 0, 0"
|
||||||
RowSpacing="0"
|
RowSpacing="0"
|
||||||
@@ -50,6 +52,7 @@
|
|||||||
</Frame>
|
</Frame>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid IsVisible="{Binding IsPolicyInEffect}"
|
<Grid IsVisible="{Binding IsPolicyInEffect}"
|
||||||
|
Margin="0, 12, 0, 0"
|
||||||
RowSpacing="0"
|
RowSpacing="0"
|
||||||
ColumnSpacing="0">
|
ColumnSpacing="0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace Bit.App.Pages
|
|||||||
private readonly IMessagingService _messagingService;
|
private readonly IMessagingService _messagingService;
|
||||||
private readonly IPlatformUtilsService _platformUtilsService;
|
private readonly IPlatformUtilsService _platformUtilsService;
|
||||||
private readonly UpdateTempPasswordPageViewModel _vm;
|
private readonly UpdateTempPasswordPageViewModel _vm;
|
||||||
|
private readonly string _pageName;
|
||||||
|
|
||||||
public UpdateTempPasswordPage()
|
public UpdateTempPasswordPage()
|
||||||
{
|
{
|
||||||
@@ -23,8 +24,10 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
// Binding
|
// Binding
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_pageName = string.Concat(nameof(UpdateTempPasswordPage), "_", DateTime.UtcNow.Ticks);
|
||||||
_vm = BindingContext as UpdateTempPasswordPageViewModel;
|
_vm = BindingContext as UpdateTempPasswordPageViewModel;
|
||||||
_vm.Page = this;
|
_vm.Page = this;
|
||||||
|
SetActivityIndicator();
|
||||||
|
|
||||||
// Actions Declaration
|
// Actions Declaration
|
||||||
_vm.LogOutAction = () =>
|
_vm.LogOutAction = () =>
|
||||||
@@ -50,7 +53,10 @@ namespace Bit.App.Pages
|
|||||||
protected override async void OnAppearing()
|
protected override async void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
await _vm.InitAsync();
|
await LoadOnAppearedAsync(_mainLayout, true, async () =>
|
||||||
|
{
|
||||||
|
await _vm.InitAsync(true);
|
||||||
|
});
|
||||||
RequestFocus(_masterPassword);
|
RequestFocus(_masterPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user