mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
* PS-591 - iOS - Avoid ambiguous characters is activated inside the main client, but is deactivated when creating a vault item from the autofill prompt. #1664 - Refactor the name of the property Ambiguous to AvoidAmbiguous, this naming was misleading. - Fixed bug where the boolean value for the AvoidAmbiguous property was being stored inverted. * PS-591 - iOS - Avoid ambiguous characters is activated inside the main client, but is deactivated when creating a vault item from the autofill prompt. #1664 - Changed AvoidAmbiguous to AllowAmbiguous - Added wrapper Prop to bind UI Toggle to VM Co-authored-by: André Bispo <abispo@bitwarden.com>
This commit is contained in:
parent
604e3b6892
commit
bcbc2738ca
5 changed files with 26 additions and 16 deletions
|
@ -277,7 +277,7 @@
|
|||
StyleClass="box-label-regular"
|
||||
HorizontalOptions="StartAndExpand" />
|
||||
<Switch
|
||||
IsToggled="{Binding AvoidAmbiguous}"
|
||||
IsToggled="{Binding AvoidAmbiguousChars}"
|
||||
StyleClass="box-value"
|
||||
HorizontalOptions="End" />
|
||||
</StackLayout>
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Bit.App.Pages
|
|||
private bool _lowercase;
|
||||
private bool _number;
|
||||
private bool _special;
|
||||
private bool _avoidAmbiguous;
|
||||
private bool _allowAmbiguousChars;
|
||||
private int _minNumber;
|
||||
private int _minSpecial;
|
||||
private int _length = 5;
|
||||
|
@ -130,19 +130,29 @@ namespace Bit.App.Pages
|
|||
}
|
||||
}
|
||||
|
||||
public bool AvoidAmbiguous
|
||||
public bool AllowAmbiguousChars
|
||||
{
|
||||
get => _avoidAmbiguous;
|
||||
get => _allowAmbiguousChars;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _avoidAmbiguous, value))
|
||||
if (SetProperty(ref _allowAmbiguousChars, value,
|
||||
additionalPropertyNames: new string[]
|
||||
{
|
||||
nameof(AvoidAmbiguousChars)
|
||||
}))
|
||||
{
|
||||
_options.Ambiguous = !value;
|
||||
_options.AllowAmbiguousChar = value;
|
||||
var task = SaveOptionsAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool AvoidAmbiguousChars
|
||||
{
|
||||
get => !AllowAmbiguousChars;
|
||||
set => AllowAmbiguousChars = !value;
|
||||
}
|
||||
|
||||
public int MinNumber
|
||||
{
|
||||
get => _minNumber;
|
||||
|
@ -315,7 +325,7 @@ namespace Bit.App.Pages
|
|||
|
||||
private void LoadFromOptions()
|
||||
{
|
||||
AvoidAmbiguous = !_options.Ambiguous.GetValueOrDefault();
|
||||
AllowAmbiguousChars = _options.AllowAmbiguousChar.GetValueOrDefault();
|
||||
TypeSelectedIndex = _options.Type == "passphrase" ? 1 : 0;
|
||||
IsPassword = TypeSelectedIndex == 0;
|
||||
MinNumber = _options.MinNumber.GetValueOrDefault();
|
||||
|
@ -333,7 +343,7 @@ namespace Bit.App.Pages
|
|||
|
||||
private void SetOptions()
|
||||
{
|
||||
_options.Ambiguous = !AvoidAmbiguous;
|
||||
_options.AllowAmbiguousChar = AllowAmbiguousChars;
|
||||
_options.Type = TypeSelectedIndex == 1 ? "passphrase" : "password";
|
||||
_options.MinNumber = MinNumber;
|
||||
_options.MinSpecial = MinSpecial;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
if (defaultOptions)
|
||||
{
|
||||
Length = 14;
|
||||
Ambiguous = false;
|
||||
AllowAmbiguousChar = true;
|
||||
Number = true;
|
||||
MinNumber = 1;
|
||||
Uppercase = true;
|
||||
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
|
||||
public int? Length { get; set; }
|
||||
public bool? Ambiguous { get; set; }
|
||||
public bool? AllowAmbiguousChar { get; set; }
|
||||
public bool? Number { get; set; }
|
||||
public int? MinNumber { get; set; }
|
||||
public bool? Uppercase { get; set; }
|
||||
|
@ -45,7 +45,7 @@
|
|||
public void Merge(PasswordGenerationOptions defaults)
|
||||
{
|
||||
Length = Length ?? defaults.Length;
|
||||
Ambiguous = Ambiguous ?? defaults.Ambiguous;
|
||||
AllowAmbiguousChar = AllowAmbiguousChar ?? defaults.AllowAmbiguousChar;
|
||||
Number = Number ?? defaults.Number;
|
||||
MinNumber = MinNumber ?? defaults.MinNumber;
|
||||
Uppercase = Uppercase ?? defaults.Uppercase;
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace Bit.Core.Services
|
|||
// Build out other character sets
|
||||
var allCharSet = string.Empty;
|
||||
var lowercaseCharSet = LowercaseCharSet;
|
||||
if (options.Ambiguous.GetValueOrDefault())
|
||||
if (options.AllowAmbiguousChar.GetValueOrDefault())
|
||||
{
|
||||
lowercaseCharSet = string.Concat(lowercaseCharSet, "l");
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace Bit.Core.Services
|
|||
}
|
||||
|
||||
var uppercaseCharSet = UppercaseCharSet;
|
||||
if (options.Ambiguous.GetValueOrDefault())
|
||||
if (options.AllowAmbiguousChar.GetValueOrDefault())
|
||||
{
|
||||
uppercaseCharSet = string.Concat(uppercaseCharSet, "IO");
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace Bit.Core.Services
|
|||
}
|
||||
|
||||
var numberCharSet = NumberCharSet;
|
||||
if (options.Ambiguous.GetValueOrDefault())
|
||||
if (options.AllowAmbiguousChar.GetValueOrDefault())
|
||||
{
|
||||
numberCharSet = string.Concat(numberCharSet, "01");
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace Bit.iOS.Core.Controllers
|
|||
MinNumbersCell.Value = options.MinNumber.GetValueOrDefault(1);
|
||||
MinSpecialCell.Value = options.MinSpecial.GetValueOrDefault(1);
|
||||
LengthCell.Value = options.Length.GetValueOrDefault(14);
|
||||
AmbiguousCell.Switch.On = options.Ambiguous.GetValueOrDefault();
|
||||
AmbiguousCell.Switch.On = !options.AllowAmbiguousChar.GetValueOrDefault();
|
||||
|
||||
NumWordsCell.Value = options.NumWords.GetValueOrDefault(3);
|
||||
WordSeparatorCell.TextField.Text = options.WordSeparator ?? "";
|
||||
|
@ -219,7 +219,7 @@ namespace Bit.iOS.Core.Controllers
|
|||
Special = SpecialCell.Switch.On,
|
||||
MinSpecial = MinSpecialCell.Value,
|
||||
MinNumber = MinNumbersCell.Value,
|
||||
Ambiguous = AmbiguousCell.Switch.On,
|
||||
AllowAmbiguousChar = !AmbiguousCell.Switch.On,
|
||||
NumWords = NumWordsCell.Value,
|
||||
WordSeparator = WordSeparatorCell.TextField.Text,
|
||||
Capitalize = CapitalizeCell.Switch.On,
|
||||
|
|
Loading…
Reference in a new issue