mirror of
https://github.com/bitwarden/mobile
synced 2026-01-06 10:34:07 +00:00
exposed password check
This commit is contained in:
@@ -83,6 +83,7 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label
|
||||
Text="{u:I18n Password}"
|
||||
@@ -101,12 +102,19 @@
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
IsVisible="{Binding ShowPassword}" />
|
||||
<controls:FaButton
|
||||
StyleClass="box-row-button, box-row-button-platform"
|
||||
Text=""
|
||||
Command="{Binding CheckPasswordCommand}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.RowSpan="2" />
|
||||
<controls:FaButton
|
||||
StyleClass="box-row-button, box-row-button-platform"
|
||||
Text="{Binding ShowPasswordIcon}"
|
||||
Command="{Binding TogglePasswordCommand}"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.Column="2"
|
||||
Grid.RowSpan="2" />
|
||||
<controls:FaButton
|
||||
StyleClass="box-row-button, box-row-button-platform"
|
||||
@@ -114,7 +122,7 @@
|
||||
Command="{Binding CopyCommand}"
|
||||
CommandParameter="LoginPassword"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Grid.Column="3"
|
||||
Grid.RowSpan="2" />
|
||||
</Grid>
|
||||
<BoxView StyleClass="box-row-separator" />
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Bit.App.Pages
|
||||
private readonly IUserService _userService;
|
||||
private readonly ITotpService _totpService;
|
||||
private readonly IPlatformUtilsService _platformUtilsService;
|
||||
private readonly IAuditService _auditService;
|
||||
private CipherView _cipher;
|
||||
private List<ViewFieldViewModel> _fields;
|
||||
private bool _canAccessPremium;
|
||||
@@ -38,11 +39,13 @@ namespace Bit.App.Pages
|
||||
_userService = ServiceContainer.Resolve<IUserService>("userService");
|
||||
_totpService = ServiceContainer.Resolve<ITotpService>("totpService");
|
||||
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
|
||||
_auditService = ServiceContainer.Resolve<IAuditService>("auditService");
|
||||
CopyCommand = new Command<string>((id) => CopyAsync(id, null));
|
||||
CopyUriCommand = new Command<LoginUriView>(CopyUriAsync);
|
||||
LaunchUriCommand = new Command<LoginUriView>(LaunchUriAsync);
|
||||
CopyUriCommand = new Command<LoginUriView>(CopyUri);
|
||||
LaunchUriCommand = new Command<LoginUriView>(LaunchUri);
|
||||
TogglePasswordCommand = new Command(TogglePassword);
|
||||
ToggleCardCodeCommand = new Command(ToggleCardCode);
|
||||
CheckPasswordCommand = new Command(CheckPasswordAsync);
|
||||
|
||||
PageTitle = AppResources.ViewItem;
|
||||
}
|
||||
@@ -52,6 +55,7 @@ namespace Bit.App.Pages
|
||||
public Command LaunchUriCommand { get; set; }
|
||||
public Command TogglePasswordCommand { get; set; }
|
||||
public Command ToggleCardCodeCommand { get; set; }
|
||||
public Command CheckPasswordCommand { get; set; }
|
||||
public string CipherId { get; set; }
|
||||
public CipherView Cipher
|
||||
{
|
||||
@@ -221,6 +225,25 @@ namespace Bit.App.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private async void CheckPasswordAsync()
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(Cipher.Login?.Password))
|
||||
{
|
||||
return;
|
||||
}
|
||||
await _deviceActionService.ShowLoadingAsync(AppResources.CheckingPassword);
|
||||
var matches = await _auditService.PasswordLeakedAsync(Cipher.Login.Password);
|
||||
await _deviceActionService.HideLoadingAsync();
|
||||
if(matches > 0)
|
||||
{
|
||||
await _platformUtilsService.ShowDialogAsync(string.Format(AppResources.PasswordExposed, matches));
|
||||
}
|
||||
else
|
||||
{
|
||||
await _platformUtilsService.ShowDialogAsync(AppResources.PasswordSafe);
|
||||
}
|
||||
}
|
||||
|
||||
private async void CopyAsync(string id, string text = null)
|
||||
{
|
||||
string name = null;
|
||||
@@ -254,12 +277,12 @@ namespace Bit.App.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyUriAsync(LoginUriView uri)
|
||||
private void CopyUri(LoginUriView uri)
|
||||
{
|
||||
CopyAsync("LoginUri", uri.Uri);
|
||||
}
|
||||
|
||||
private void LaunchUriAsync(LoginUriView uri)
|
||||
private void LaunchUri(LoginUriView uri)
|
||||
{
|
||||
if(uri.CanLaunch)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user