mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-06 13:01:46 -07:00
refactor: squash commits
This commit is contained in:
parent
63ebcb5915
commit
1e6e237aa3
107 changed files with 20077 additions and 0 deletions
16
backend/utils/init-admin.js
Normal file
16
backend/utils/init-admin.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
const crypto = require("crypto");
|
||||
const hashPassword = require("pbkdf2-wrapper/hashText");
|
||||
|
||||
module.exports = async function () {
|
||||
if (!process.env.ZU_DEFAULT_PASSWORD || !process.env.ZU_DEFAULT_USERNAME) {
|
||||
console.error("ZU_DEFAULT_PASSWORD or ZU_DEFAULT_USERNAME not found!");
|
||||
process.exit(1);
|
||||
}
|
||||
const username = process.env.ZU_DEFAULT_USERNAME;
|
||||
const hash = await hashPassword(process.env.ZU_DEFAULT_PASSWORD);
|
||||
return {
|
||||
username: username,
|
||||
password_hash: hash,
|
||||
token: crypto.randomBytes(16).toString("hex"),
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue