Compare commits

...

2 Commits

Author SHA1 Message Date
Patrick c207da0462 updated the login form to use use:enhance 2025-07-11 17:45:31 +02:00
Patrick 8df1c6ddc1 added missing base url 2025-07-11 17:45:09 +02:00
2 changed files with 8 additions and 5 deletions

View File

@ -3,7 +3,8 @@
import { untrack } from "svelte";
import { enhance } from "$app/forms";
import { page } from "$app/state"
import { page } from "$app/state";
import { base } from "$app/paths";
import type { RecordEntry } from "$lib/db_types"
import { MONTHS, toInt, padInt, parseDate, calculateDuration, weekday_of } from "$lib/util";
@ -263,13 +264,13 @@
<tr>
<td colspan="2" class="doc_action">
{#if document == null}
<form id="form_create_rec" method="POST" action="/dokumente?/create_record">
<form id="form_create_rec" method="POST" action="{base}/dokumente?/create_record">
<input type="hidden" name="month" value={month + 1} />
<input type="hidden" name="year" value={year} />
<button type="submit">Stundenliste erstellen</button>
</form>
{:else}
<form id="form_download" method="GET" action={`/dokumente/${document.path}`} target="_blank">
<form id="form_download" method="GET" action={`${base}/dokumente/${document.path}`} target="_blank">
<input type="hidden" name="month" value={month + 1} />
<input type="hidden" name="year" value={year} />
<button type="submit">Download</button>

View File

@ -1,12 +1,14 @@
<script lang="ts">
import type { PageProps } from "./$types";
import { enhance } from "$app/forms";
let { form }: PageProps = $props();
</script>
<div>
<h1>Login</h1>
<form id="login" method="POST" action="?/login">
<form id="login" method="POST" action="?/login" use:enhance={({formElement}) => { formElement.reset() }}>
<table>
<tbody>
<tr>
@ -15,7 +17,7 @@
</tr>
<tr>
<td><label for="password">Passwort:</label></td>
<td><input type="password" id="password" name="password" required /></td>
<td><input type="password" id="password" name="password" required /></td> <!-- form.password should never be defined -->
</tr>
<tr>
<td colspan="2"><button type="submit">Login</button></td>