This commit is contained in:
2020-11-18 23:19:13 +00:00
parent f047ac40be
commit 6d1e2b6f88
4 changed files with 26 additions and 7 deletions

View File

@@ -243,6 +243,20 @@ export default {
}
return hash;
},
////////////////////////////////////////
// Random password / login generator
// https://stackoverflow.com/a/51540480/8939
// using 32 character (128 bit) as default
//
getRandomPassword: function() {
let length = 32,
wishlist = "0123456789abcdefghijkmnopqrstuvwxyz";
return Array.from(crypto.getRandomValues(new Uint32Array(length)))
.map(x => wishlist[x % wishlist.length])
.join("");
},
///////////////////////////////
// CONVERT STRING TO BOOLEAN
// https://stackoverflow.com/a/1414175/8939