Files
dotter/resources/js/pages/auth/Login.svelte
T
salam e687b4437b
linter / quality (push) Canceled after 0s
tests / ci (8.3) (push) Canceled after 0s
tests / ci (8.4) (push) Canceled after 0s
tests / ci (8.5) (push) Canceled after 0s
first commit
2026-10-06 18:53:03 +02:00

107 lines
3.3 KiB
Svelte

<script module lang="ts">
export const layout = {
title: 'Log in to your account',
description: 'Enter your email and password below to log in',
};
</script>
<script lang="ts">
import { Form } from '@inertiajs/svelte';
import AppHead from '@/components/AppHead.svelte';
import InputError from '@/components/InputError.svelte';
import PasswordInput from '@/components/PasswordInput.svelte';
import TextLink from '@/components/TextLink.svelte';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Spinner } from '@/components/ui/spinner';
import { register } from '@/routes';
import { store } from '@/routes/login';
import { request } from '@/routes/password';
let {
status = '',
canResetPassword,
canRegister,
}: {
status?: string;
canResetPassword: boolean;
canRegister: boolean;
} = $props();
</script>
<AppHead title="Log in" />
{#if status}
<div class="mb-4 text-center text-sm font-medium text-green-600">
{status}
</div>
{/if}
<Form
{...store.form()}
resetOnSuccess={['password']}
class="flex flex-col gap-6"
>
{#snippet children({ errors, processing })}
<div class="grid gap-6">
<div class="grid gap-2">
<Label for="email">Email address</Label>
<Input
id="email"
type="email"
name="email"
required
autocomplete="email"
placeholder="email@example.com"
/>
<InputError message={errors.email} />
</div>
<div class="grid gap-2">
<div class="flex items-center justify-between">
<Label for="password">Password</Label>
{#if canResetPassword}
<TextLink href={request()} class="text-sm">
Forgot password?
</TextLink>
{/if}
</div>
<PasswordInput
id="password"
name="password"
required
autocomplete="current-password"
placeholder="Password"
/>
<InputError message={errors.password} />
</div>
<div class="flex items-center justify-between">
<Label for="remember" class="flex items-center space-x-3">
<Checkbox id="remember" name="remember" />
<span>Remember me</span>
</Label>
</div>
<Button
type="submit"
class="mt-4 w-full"
disabled={processing}
data-test="login-button"
>
{#if processing}<Spinner />{/if}
Log in
</Button>
</div>
{#if canRegister}
<div class="text-center text-sm text-muted-foreground">
Don't have an account?
<TextLink href={register()}>Sign up</TextLink>
</div>
{/if}
{/snippet}
</Form>