mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-21 20:36:57 +00:00
Better password generator
This commit is contained in:
parent
c2448a7e4e
commit
d79c5ada53
@ -62,8 +62,7 @@ $(function() {
|
|||||||
} else {
|
} else {
|
||||||
fs(window.TEMPORARY,
|
fs(window.TEMPORARY,
|
||||||
100,
|
100,
|
||||||
log.bind(log, "WARNING: Your browser is not in incognito mode!"),
|
log.bind(log, "WARNING: Your browser is not in incognito mode!"));
|
||||||
log.bind(log, "Your browser is in incognito mode."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the username is valid
|
// If the username is valid
|
||||||
@ -273,7 +272,7 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$genKey.click(function () {
|
$genKey.click(function () {
|
||||||
let key = (Math.random() * Math.random()).toString(36).substring(7);
|
let key = generatePassword();
|
||||||
updateKeyVal(key);
|
updateKeyVal(key);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -286,7 +285,7 @@ $(function() {
|
|||||||
|
|
||||||
users = data.users;
|
users = data.users;
|
||||||
|
|
||||||
let key = (Math.random() * Math.random()).toString(36).substring(7);
|
let key = generatePassword();
|
||||||
|
|
||||||
if (data.numUsers > 1) {
|
if (data.numUsers > 1) {
|
||||||
$('#join-modal').modal('show');
|
$('#join-modal').modal('show');
|
||||||
@ -499,4 +498,14 @@ $(function() {
|
|||||||
typing = false;
|
typing = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function generatePassword() {
|
||||||
|
let length = 16;
|
||||||
|
const charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
|
let retVal = "";
|
||||||
|
for (var i = 0, n = charset.length; i < length; ++i) {
|
||||||
|
retVal += charset.charAt(Math.floor(Math.random() * n));
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user