Compare commits

...

3 Commits

3 changed files with 6 additions and 7 deletions

View File

@ -9,7 +9,7 @@ import { init_db, close_db, create_user, do_users_exist } from "$lib/server/data
import Logs from "$lib/server/log";
let local_setup: {user_setup: (() => void) | ((username: string, password: string) => void) }= {
user_setup: () => {}
user_setup: async () => {}
}
async function init() {
@ -28,12 +28,12 @@ async function init() {
await init_db();
if (!do_users_exist()) {
local_setup.user_setup = (username: string, password: string) => {
local_setup.user_setup = async (username: string, password: string) => {
Logs.user.info("Creating first user")
create_user({name: "name", gender: "x", address: "home", username: username, password: password });
await create_user({name: "name", gender: "x", address: "home", username: username, password: password });
local_setup.user_setup = () => {}
local_setup.user_setup = async () => {}
}
}

View File

@ -118,7 +118,7 @@ const ENTRY_DATABASE_SETUP: string[] = [
record_id INTEGER NOT NULL,
date VARCHAR(10),
start VARCHAR(5),
end VARCHAR(5),
end V<F52>ARCHAR(5),
comment TEXT,
modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY(record_id) REFERENCES records(id)

View File

@ -34,12 +34,11 @@ export const actions = {
redirect(302, _get_redirect(url));
}
const params = await request.formData();
const username = params.get("username") as string | null;
const password = params.get("password") as string | null;
locals.setup.user_setup(username, password)
await locals.setup.user_setup(username, password)
Logs.user.info(`Login attempt for user ${username}`)