diff --git a/src/app/vault/password-generator.component.html b/src/app/vault/password-generator.component.html index 915a3f23d2..23496639a5 100644 --- a/src/app/vault/password-generator.component.html +++ b/src/app/vault/password-generator.component.html @@ -57,12 +57,12 @@
-
-
diff --git a/src/app/vault/password-generator.component.ts b/src/app/vault/password-generator.component.ts index fad8dbad6c..7c87bda0a9 100644 --- a/src/app/vault/password-generator.component.ts +++ b/src/app/vault/password-generator.component.ts @@ -84,6 +84,9 @@ export class PasswordGeneratorComponent implements OnInit { } private normalizeOptions() { + this.options.minLowercase = 0; + this.options.minUppercase = 0; + if (!this.options.uppercase && !this.options.lowercase && !this.options.number && !this.options.special) { this.options.lowercase = true; const lowercase = document.querySelector('#lowercase') as HTMLInputElement; @@ -91,22 +94,31 @@ export class PasswordGeneratorComponent implements OnInit { lowercase.checked = true; } } - if (!this.options.minNumber) { - this.options.minNumber = 0; - } else if (this.options.minNumber > 5) { - this.options.minNumber = 5; - } - - if (!this.options.minSpecial) { - this.options.minSpecial = 0; - } else if (this.options.minSpecial > 5) { - this.options.minSpecial = 5; - } if (!this.options.length) { this.options.length = 5; } else if (this.options.length > 128) { this.options.length = 128; } + + if (!this.options.minNumber) { + this.options.minNumber = 0; + } else if (this.options.minNumber > this.options.length) { + this.options.minNumber = this.options.length; + } else if (this.options.minNumber > 9) { + this.options.minNumber = 9; + } + + if (!this.options.minSpecial) { + this.options.minSpecial = 0; + } else if (this.options.minSpecial > this.options.length) { + this.options.minSpecial = this.options.length; + } else if (this.options.minSpecial > 9) { + this.options.minSpecial = 9; + } + + if (this.options.minSpecial + this.options.minNumber > this.options.length) { + this.options.minSpecial = this.options.length - this.options.minNumber; + } } } diff --git a/src/app/vault/vault.component.html b/src/app/vault/vault.component.html index 660337b218..b9d270ada5 100644 --- a/src/app/vault/vault.component.html +++ b/src/app/vault/vault.component.html @@ -27,7 +27,7 @@ (onDeletedCipher)="deletedCipher($event)" (onEditAttachments)="editCipherAttachments($event)" (onCancelled)="cancelledAddEdit($event)" - (onGeneratePassword)="openPasswordGenerator()"> + (onGeneratePassword)="openPasswordGenerator(true)">