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