mirror of https://github.com/keeweb/keeweb
fixed phonetic password generation
parent
966d814281
commit
0ce436c2e9
|
@ -312,7 +312,8 @@ function generate(options) {
|
|||
word: '',
|
||||
opts: options
|
||||
};
|
||||
while (wordObj.word.length < length) {
|
||||
const safeMaxLength = length + 5;
|
||||
while (wordObj.word.length < safeMaxLength) {
|
||||
addSyllable(wordObj);
|
||||
}
|
||||
return postProcess(wordObj).substr(0, length);
|
||||
|
|
|
@ -41,9 +41,11 @@ describe('PasswordGenerator', () => {
|
|||
});
|
||||
|
||||
it('should generate a pronounceable password', () => {
|
||||
expect(PasswordGenerator.generate({ length: 10, name: 'Pronounceable' })).to.match(
|
||||
/^[a-zA-Z]{10}$/
|
||||
);
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
expect(PasswordGenerator.generate({ length: 10, name: 'Pronounceable' })).to.match(
|
||||
/^[a-zA-Z]{10}$/
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it('should generate a password with pattern', () => {
|
||||
|
|
Loading…
Reference in New Issue