mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Accounts and login.
This commit is contained in:
parent
f3f0ad15f2
commit
49a55b40b4
22 changed files with 347 additions and 172 deletions
28
scripts/create-account.js
Normal file
28
scripts/create-account.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
const { PrismaClient } = require('@prisma/client');
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
const exec = async () => {
|
||||
const account = await prisma.account.findOne({
|
||||
where: {
|
||||
username: 'admin',
|
||||
},
|
||||
});
|
||||
|
||||
if (!account) {
|
||||
await prisma.account.create({
|
||||
data: {
|
||||
username: 'admin',
|
||||
password: '$2a$10$BXHPV7APlV1I6WrKJt1igeJAyVsvbhMTaTAi3nHkUJFGPsYmfZq3y',
|
||||
is_admin: true,
|
||||
},
|
||||
});
|
||||
console.log('Account succesfully created.');
|
||||
} else {
|
||||
console.log('Account already exists.');
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
exec();
|
||||
Loading…
Add table
Add a link
Reference in a new issue