1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-27 12:26:31 +01:00

fix min character assignments for pw gen

This commit is contained in:
Kyle Spearrin 2019-10-05 20:39:42 -04:00
parent a363712127
commit 0e966c0304

View File

@ -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;