Remove \ character from password generation to avoid confusions
This commit is contained in:
parent
6604fbb6e1
commit
487283626f
|
@ -63,6 +63,8 @@ function generate_random(size, only_ascii)
|
|||
else
|
||||
symbols = new Array(1, 255);
|
||||
|
||||
forbidden = new Array('\\');
|
||||
|
||||
var res = "";
|
||||
while (res.length < size)
|
||||
{
|
||||
|
@ -71,7 +73,18 @@ function generate_random(size, only_ascii)
|
|||
r = Math.round(Math.random()*diff);
|
||||
if (isNaN(r+symbols[a]))
|
||||
continue;
|
||||
res += String.fromCharCode(r + symbols[a]);
|
||||
character = String.fromCharCode(r + symbols[a]);
|
||||
forbid = false;
|
||||
for (var j=0; j<forbidden.length; j++)
|
||||
{
|
||||
if (character == forbidden[j])
|
||||
{
|
||||
forbid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (forbid) continue;
|
||||
res += character;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
Loading…
Reference in New Issue
Block a user