Compare commits
3 Commits
170e8a8c4f
...
15ba32095d
| Author | SHA1 | Date |
|---|---|---|
|
|
15ba32095d | |
|
|
8c2039c8a4 | |
|
|
f801f82faa |
|
|
@ -9,7 +9,7 @@ import { init_db, close_db, create_user, do_users_exist } from "$lib/server/data
|
||||||
import Logs from "$lib/server/log";
|
import Logs from "$lib/server/log";
|
||||||
|
|
||||||
let local_setup: {user_setup: (() => void) | ((username: string, password: string) => void) }= {
|
let local_setup: {user_setup: (() => void) | ((username: string, password: string) => void) }= {
|
||||||
user_setup: () => {}
|
user_setup: async () => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
|
|
@ -28,12 +28,12 @@ async function init() {
|
||||||
await init_db();
|
await init_db();
|
||||||
|
|
||||||
if (!do_users_exist()) {
|
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")
|
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 () => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ const ENTRY_DATABASE_SETUP: string[] = [
|
||||||
record_id INTEGER NOT NULL,
|
record_id INTEGER NOT NULL,
|
||||||
date VARCHAR(10),
|
date VARCHAR(10),
|
||||||
start VARCHAR(5),
|
start VARCHAR(5),
|
||||||
end VARCHAR(5),
|
end V<F52>ARCHAR(5),
|
||||||
comment TEXT,
|
comment TEXT,
|
||||||
modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
FOREIGN KEY(record_id) REFERENCES records(id)
|
FOREIGN KEY(record_id) REFERENCES records(id)
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,11 @@ export const actions = {
|
||||||
redirect(302, _get_redirect(url));
|
redirect(302, _get_redirect(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const params = await request.formData();
|
const params = await request.formData();
|
||||||
const username = params.get("username") as string | null;
|
const username = params.get("username") as string | null;
|
||||||
const password = params.get("password") 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}`)
|
Logs.user.info(`Login attempt for user ${username}`)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue