Compare commits
No commits in common. "15ba32095d1bffe851e3c9448020485cd92fe353" and "170e8a8c4fa5f8f8415afdc4c72fbb75217f187a" have entirely different histories.
15ba32095d
...
170e8a8c4f
|
|
@ -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: async () => {}
|
||||
user_setup: () => {}
|
||||
}
|
||||
|
||||
async function init() {
|
||||
|
|
@ -28,12 +28,12 @@ async function init() {
|
|||
await init_db();
|
||||
|
||||
if (!do_users_exist()) {
|
||||
local_setup.user_setup = async (username: string, password: string) => {
|
||||
local_setup.user_setup = (username: string, password: string) => {
|
||||
Logs.user.info("Creating first user")
|
||||
|
||||
await create_user({name: "name", gender: "x", address: "home", username: username, password: password });
|
||||
create_user({name: "name", gender: "x", address: "home", username: username, password: password });
|
||||
|
||||
local_setup.user_setup = async () => {}
|
||||
local_setup.user_setup = () => {}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ const ENTRY_DATABASE_SETUP: string[] = [
|
|||
record_id INTEGER NOT NULL,
|
||||
date VARCHAR(10),
|
||||
start VARCHAR(5),
|
||||
end V<F52>ARCHAR(5),
|
||||
end VARCHAR(5),
|
||||
comment TEXT,
|
||||
modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
FOREIGN KEY(record_id) REFERENCES records(id)
|
||||
|
|
|
|||
|
|
@ -33,12 +33,13 @@ export const actions = {
|
|||
if (locals.user != null) {
|
||||
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;
|
||||
|
||||
await locals.setup.user_setup(username, password)
|
||||
locals.setup.user_setup(username, password)
|
||||
|
||||
Logs.user.info(`Login attempt for user ${username}`)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue