1
0
mirror of https://github.com/S2-/pwgen.git synced 2025-08-02 08:50:04 +02:00

escape \ so it can be used as special char

This commit is contained in:
s2
2017-11-16 08:41:27 +01:00
parent 7a9255e518
commit 76362b8b6d

View File

@@ -1,7 +1,7 @@
function randPassword(length, includeSpecial) {
let pwdChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
if (includeSpecial) {
pwdChars += '°^!"§$%&/()=?`´\}][{²³€|<>-.,;:*+_';
pwdChars += '°^!"§$%&\/()=?`´\\}][{²³€|<>-.,;:*+_';
}
let randPassword = Array(length).fill(pwdChars).map(function(x) {
return x[Math.floor(Math.random() * x.length)]