generated from mirzaev/pot
большая разработка аутентификации
This commit is contained in:
24
mirzaev/site/account/system/public/js/password.js
Normal file
24
mirzaev/site/account/system/public/js/password.js
Normal file
@@ -0,0 +1,24 @@
|
||||
'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;
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user