mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
Add a passphrase generation mechanism (#12)
Based on EFF's wordlist The wordlist was selected based on arguments mentionned in https://www.eff.org/deeplinks/2016/07/new-wordlists-random-passphrases over Arnold Reinhold's Diceware list from 1995 such as avoid short, deused or diffcult to pronounce words
This commit is contained in:
committed by
Kyle Spearrin
parent
7b3fce1779
commit
c4da05dbb0
@@ -78,6 +78,12 @@ export class PasswordGeneratorComponent implements OnInit {
|
||||
this.options.minUppercase = 0;
|
||||
this.options.ambiguous = !this.avoidAmbiguous;
|
||||
|
||||
let typePassword = false;
|
||||
if (!this.options.generateTypePassword || this.options.generateTypePassword === 'generate-password') {
|
||||
typePassword = true;
|
||||
}
|
||||
this.options.generatePassphrase = !typePassword;
|
||||
|
||||
if (!this.options.uppercase && !this.options.lowercase && !this.options.number && !this.options.special) {
|
||||
this.options.lowercase = true;
|
||||
const lowercase = document.querySelector('#lowercase') as HTMLInputElement;
|
||||
@@ -111,5 +117,9 @@ export class PasswordGeneratorComponent implements OnInit {
|
||||
if (this.options.minSpecial + this.options.minNumber > this.options.length) {
|
||||
this.options.minSpecial = this.options.length - this.options.minNumber;
|
||||
}
|
||||
|
||||
if (!this.options.numWords || this.options.length < 3) {
|
||||
this.options.numWords = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user