restructured default admin creation

This commit is contained in:
Laurin
2022-10-20 16:08:10 +02:00
committed by La_Felx
parent ff13a95eac
commit 28d48cd178
2 changed files with 3 additions and 15 deletions
+1 -1
View File
@@ -20,6 +20,6 @@ export const generateDefaultCredentials = async () => {
update: {},
});
logger.notice("Default admin name is " + name);
logger.notice("Default admin name is: " + name);
logger.notice("Confidential password: " + pw);
};
+2 -14
View File
@@ -35,25 +35,11 @@ async function main() {
"This mode should not be used in any production-near environment as it is significantly less secure than the production mode"
);
generateDefaultCredentials();
// TODO: How should you login to the prod server by default? Maybe random password?
await prisma.admin.upsert({
where: { id: 1 },
create: {
name: "admin",
password: await argon2.hash("test", { type: argon2.argon2id }),
permission_level: "ELEVATED",
},
update: {},
});
// Allow all CORS requests
app.use(cors());
} else {
logger.info("Using production mode");
generateDefaultCredentials();
// Configure cors
/*app.use(
cors({
@@ -72,6 +58,8 @@ async function main() {
});
}
generateDefaultCredentials();
// Todo: Everything
// Bodyparser and urlencoded to parse post request bodies