mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
fix min character assignments for pw gen
This commit is contained in:
parent
a363712127
commit
0e966c0304
1 changed files with 20 additions and 1 deletions
|
@ -51,25 +51,44 @@ namespace Bit.Core.Services
|
|||
{
|
||||
options.MinUppercase = 1;
|
||||
}
|
||||
else if(!options.Uppercase.GetValueOrDefault())
|
||||
{
|
||||
options.MinUppercase = 0;
|
||||
}
|
||||
|
||||
if(options.Lowercase.GetValueOrDefault() && options.MinLowercase.GetValueOrDefault() <= 0)
|
||||
{
|
||||
options.MinLowercase = 1;
|
||||
}
|
||||
else if(!options.Lowercase.GetValueOrDefault())
|
||||
{
|
||||
options.MinLowercase = 0;
|
||||
}
|
||||
|
||||
if(options.Number.GetValueOrDefault() && options.MinNumber.GetValueOrDefault() <= 0)
|
||||
{
|
||||
options.MinNumber = 1;
|
||||
}
|
||||
else if(!options.Number.GetValueOrDefault())
|
||||
{
|
||||
options.MinNumber = 0;
|
||||
}
|
||||
|
||||
if(options.Special.GetValueOrDefault() && options.MinSpecial.GetValueOrDefault() <= 0)
|
||||
{
|
||||
options.MinSpecial = 1;
|
||||
}
|
||||
else if(!options.Special.GetValueOrDefault())
|
||||
{
|
||||
options.MinSpecial = 0;
|
||||
}
|
||||
|
||||
if(options.Length.GetValueOrDefault() < 1)
|
||||
{
|
||||
options.Length = 10;
|
||||
}
|
||||
var minLength = options.MinSpecial.GetValueOrDefault() + options.MinLowercase.GetValueOrDefault() +
|
||||
options.MinNumber.GetValueOrDefault() + options.MinSpecial.GetValueOrDefault();
|
||||
options.MinNumber.GetValueOrDefault() + options.MinUppercase.GetValueOrDefault();
|
||||
if(options.Length < minLength)
|
||||
{
|
||||
options.Length = minLength;
|
||||
|
|
Loading…
Reference in a new issue