mirror of https://github.com/keeweb/keeweb.git
fix: convert space character to non-breaking space on password reveal
addresses issue with having space characters in passwords and pressing the 'reveal password' button.
This commit is contained in:
parent
6690d01643
commit
0f8332b07a
|
@ -7,8 +7,14 @@ class RandomNameGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
// activated when user presses 'reveal' on password
|
||||
function charCodeToHtml(char) {
|
||||
return Math.random() < 0.2 ? String.fromCharCode(char) : `&#x${char.toString(16)};`;
|
||||
// convert certain special chars like space into to non-breaking space
|
||||
// ' ' to &#nbsp;
|
||||
if ( char === 32 || char === 8193 || char === 8239 )
|
||||
char = 160;
|
||||
|
||||
return Math.random( ) < 0.2 ? String.fromCharCode( char ) : `&#x${ char.toString( 16 ) };`;
|
||||
}
|
||||
|
||||
const PasswordPresenter = {
|
||||
|
|
Loading…
Reference in New Issue