mirror of
https://github.com/bitwarden/android.git
synced 2024-11-01 07:35:52 +03:00
pass gen fixes
This commit is contained in:
parent
99f00b8e63
commit
9400c22e4f
4 changed files with 41 additions and 13 deletions
|
@ -35,7 +35,7 @@
|
||||||
Text="{Binding Password}"
|
Text="{Binding Password}"
|
||||||
Margin="0, 20"
|
Margin="0, 20"
|
||||||
StyleClass="text-lg"
|
StyleClass="text-lg"
|
||||||
HorizontalOptions="Center"
|
HorizontalTextAlignment="Center"
|
||||||
LineBreakMode="CharacterWrap" />
|
LineBreakMode="CharacterWrap" />
|
||||||
<StackLayout Orientation="Horizontal">
|
<StackLayout Orientation="Horizontal">
|
||||||
<Button Text="{u:I18n RegeneratePassword}"
|
<Button Text="{u:I18n RegeneratePassword}"
|
||||||
|
@ -78,8 +78,8 @@
|
||||||
VerticalTextAlignment="Center" />
|
VerticalTextAlignment="Center" />
|
||||||
<Stepper
|
<Stepper
|
||||||
Value="{Binding NumWords}"
|
Value="{Binding NumWords}"
|
||||||
Minimum="3"
|
|
||||||
Maximum="20"
|
Maximum="20"
|
||||||
|
Minimum="3"
|
||||||
Increment="1" />
|
Increment="1" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<BoxView StyleClass="box-row-separator" />
|
<BoxView StyleClass="box-row-separator" />
|
||||||
|
@ -108,8 +108,8 @@
|
||||||
StyleClass="box-value"
|
StyleClass="box-value"
|
||||||
VerticalOptions="CenterAndExpand"
|
VerticalOptions="CenterAndExpand"
|
||||||
HorizontalOptions="FillAndExpand"
|
HorizontalOptions="FillAndExpand"
|
||||||
Minimum="0"
|
Maximum="128"
|
||||||
Maximum="128" />
|
Minimum="5" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<BoxView StyleClass="box-row-separator" />
|
<BoxView StyleClass="box-row-separator" />
|
||||||
<StackLayout StyleClass="box-row, box-row-switch">
|
<StackLayout StyleClass="box-row, box-row-switch">
|
||||||
|
@ -171,8 +171,8 @@
|
||||||
VerticalTextAlignment="Center" />
|
VerticalTextAlignment="Center" />
|
||||||
<Stepper
|
<Stepper
|
||||||
Value="{Binding MinNumber}"
|
Value="{Binding MinNumber}"
|
||||||
Minimum="0"
|
|
||||||
Maximum="5"
|
Maximum="5"
|
||||||
|
Minimum="0"
|
||||||
Increment="1" />
|
Increment="1" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<BoxView StyleClass="box-row-separator" />
|
<BoxView StyleClass="box-row-separator" />
|
||||||
|
@ -191,8 +191,8 @@
|
||||||
VerticalTextAlignment="Center" />
|
VerticalTextAlignment="Center" />
|
||||||
<Stepper
|
<Stepper
|
||||||
Value="{Binding MinSpecial}"
|
Value="{Binding MinSpecial}"
|
||||||
Minimum="0"
|
|
||||||
Maximum="5"
|
Maximum="5"
|
||||||
|
Minimum="0"
|
||||||
Increment="1" />
|
Increment="1" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<BoxView StyleClass="box-row-separator" />
|
<BoxView StyleClass="box-row-separator" />
|
||||||
|
|
|
@ -5,12 +5,22 @@ namespace Bit.App.Pages
|
||||||
public partial class GeneratorPage : BaseContentPage
|
public partial class GeneratorPage : BaseContentPage
|
||||||
{
|
{
|
||||||
private GeneratorPageViewModel _vm;
|
private GeneratorPageViewModel _vm;
|
||||||
|
private readonly Action<string> _selectAction;
|
||||||
|
|
||||||
public GeneratorPage()
|
public GeneratorPage()
|
||||||
|
: this(null)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public GeneratorPage(Action<string> selectAction)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_vm = BindingContext as GeneratorPageViewModel;
|
_vm = BindingContext as GeneratorPageViewModel;
|
||||||
_vm.Page = this;
|
_vm.Page = this;
|
||||||
|
_selectAction = selectAction;
|
||||||
|
if(selectAction == null)
|
||||||
|
{
|
||||||
|
ToolbarItems.Remove(_selectItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async override void OnAppearing()
|
protected async override void OnAppearing()
|
||||||
|
@ -31,7 +41,7 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
private void Select_Clicked(object sender, EventArgs e)
|
private void Select_Clicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
_selectAction?.Invoke(_vm.Password);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void History_Clicked(object sender, EventArgs e)
|
private void History_Clicked(object sender, EventArgs e)
|
||||||
|
|
|
@ -22,8 +22,8 @@ namespace Bit.App.Pages
|
||||||
private bool _avoidAmbiguous;
|
private bool _avoidAmbiguous;
|
||||||
private int _minNumber;
|
private int _minNumber;
|
||||||
private int _minSpecial;
|
private int _minSpecial;
|
||||||
private int _length;
|
private int _length = 5;
|
||||||
private int _numWords;
|
private int _numWords = 3;
|
||||||
private string _wordSeparator;
|
private string _wordSeparator;
|
||||||
private int _typeSelectedIndex;
|
private int _typeSelectedIndex;
|
||||||
private bool _doneIniting;
|
private bool _doneIniting;
|
||||||
|
@ -173,9 +173,10 @@ namespace Bit.App.Pages
|
||||||
get => _wordSeparator;
|
get => _wordSeparator;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(SetProperty(ref _wordSeparator, value))
|
var val = value.Trim();
|
||||||
|
if(SetProperty(ref _wordSeparator, val))
|
||||||
{
|
{
|
||||||
_options.WordSeparator = value;
|
_options.WordSeparator = val;
|
||||||
var task = SaveOptionsAsync();
|
var task = SaveOptionsAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,6 +245,7 @@ namespace Bit.App.Pages
|
||||||
WordSeparator = _options.WordSeparator;
|
WordSeparator = _options.WordSeparator;
|
||||||
Uppercase = _options.Uppercase.GetValueOrDefault();
|
Uppercase = _options.Uppercase.GetValueOrDefault();
|
||||||
Lowercase = _options.Lowercase.GetValueOrDefault();
|
Lowercase = _options.Lowercase.GetValueOrDefault();
|
||||||
|
Length = _options.Length.GetValueOrDefault(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetOptions()
|
private void SetOptions()
|
||||||
|
@ -258,6 +260,7 @@ namespace Bit.App.Pages
|
||||||
_options.WordSeparator = WordSeparator;
|
_options.WordSeparator = WordSeparator;
|
||||||
_options.Uppercase = Uppercase;
|
_options.Uppercase = Uppercase;
|
||||||
_options.Lowercase = Lowercase;
|
_options.Lowercase = Lowercase;
|
||||||
|
_options.Length = Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,9 +418,24 @@ namespace Bit.App.Pages
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GeneratePassword()
|
public async void GeneratePassword()
|
||||||
{
|
{
|
||||||
// TODO: push modal for generate page
|
if(!string.IsNullOrWhiteSpace(Cipher?.Login?.Password))
|
||||||
|
{
|
||||||
|
var confirmed = await _platformUtilsService.ShowDialogAsync(AppResources.PasswordOverrideAlert,
|
||||||
|
null, AppResources.Yes, AppResources.No);
|
||||||
|
if(!confirmed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var page = new GeneratorPage(async (password) =>
|
||||||
|
{
|
||||||
|
Cipher.Login.Password = password;
|
||||||
|
TriggerCipherChanged();
|
||||||
|
await Page.Navigation.PopModalAsync();
|
||||||
|
});
|
||||||
|
await Page.Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void UriOptions(LoginUriView uri)
|
public async void UriOptions(LoginUriView uri)
|
||||||
|
|
Loading…
Reference in a new issue