accounts/mirzaev/site/account/system/public/js/password.js

25 lines
748 B
JavaScript

'use strict';
class password {
/**
* Сгенерировать
*
* @param {number} length Длина (количество слов в мнемоническом, либо символов в классическом)
*
* @return {object} {(string) password, (array) errors}
*/
static async generate(length = 12, type = "classic") {
return await fetch("https://account.mirzaev.sexy/api/generate/password", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: `length=${length}&type=${type}&return=password,errors`,
})
.then((response) => response.json())
.then((data) => {
return data;
});
}
}