first commit
This commit is contained in:
commit
e687b4437b
418 files changed
+33577
No files matched your search
@@ -0,0 +1,50 @@
|
||||
<script module lang="ts">
|
||||
export const layout = {
|
||||
title: 'Confirm your password',
|
||||
description:
|
||||
'This is a secure area of the application. Please confirm your password before continuing.',
|
||||
};
|
||||
</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 { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
import { store } from '@/routes/password/confirm';
|
||||
</script>
|
||||
|
||||
<AppHead title="Confirm password" />
|
||||
|
||||
<Form {...store.form()} resetOnSuccess>
|
||||
{#snippet children({ errors, processing })}
|
||||
<div class="space-y-6">
|
||||
<div class="grid gap-2">
|
||||
<Label for="password">Password</Label>
|
||||
<PasswordInput
|
||||
id="password"
|
||||
name="password"
|
||||
class="mt-1 block w-full"
|
||||
required
|
||||
autocomplete="current-password"
|
||||
/>
|
||||
<InputError message={errors.password} />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center">
|
||||
<Button
|
||||
type="submit"
|
||||
class="w-full"
|
||||
disabled={processing}
|
||||
data-test="confirm-password-button"
|
||||
>
|
||||
{#if processing}<Spinner />{/if}
|
||||
Confirm password
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Form>
|
||||
@@ -0,0 +1,68 @@
|
||||
<script module lang="ts">
|
||||
export const layout = {
|
||||
title: 'Forgot password',
|
||||
description: 'Enter your email to receive a password reset link',
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { Form } from '@inertiajs/svelte';
|
||||
import AppHead from '@/components/AppHead.svelte';
|
||||
import InputError from '@/components/InputError.svelte';
|
||||
import TextLink from '@/components/TextLink.svelte';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
import { login } from '@/routes';
|
||||
import { email } from '@/routes/password';
|
||||
|
||||
let {
|
||||
status = '',
|
||||
}: {
|
||||
status?: string;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<AppHead title="Forgot password" />
|
||||
|
||||
{#if status}
|
||||
<div class="mb-4 text-center text-sm font-medium text-green-600">
|
||||
{status}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="space-y-6">
|
||||
<Form {...email.form()}>
|
||||
{#snippet children({ errors, processing })}
|
||||
<div class="grid gap-2">
|
||||
<Label for="email">Email address</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
autocomplete="off"
|
||||
placeholder="email@example.com"
|
||||
/>
|
||||
<InputError message={errors.email} />
|
||||
</div>
|
||||
|
||||
<div class="my-6 flex items-center justify-start">
|
||||
<Button
|
||||
type="submit"
|
||||
class="w-full"
|
||||
disabled={processing}
|
||||
data-test="email-password-reset-link-button"
|
||||
>
|
||||
{#if processing}<Spinner />{/if}
|
||||
Email password reset link
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Form>
|
||||
|
||||
<div class="space-x-1 text-center text-sm text-muted-foreground">
|
||||
<span>Or, return to</span>
|
||||
<TextLink href={login()}>log in</TextLink>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,106 @@
|
||||
<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>
|
||||
@@ -0,0 +1,99 @@
|
||||
<script module lang="ts">
|
||||
export const layout = {
|
||||
title: 'Create an account',
|
||||
description: 'Enter your details below to create your account',
|
||||
};
|
||||
</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 { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
import { login } from '@/routes';
|
||||
import { store } from '@/routes/register';
|
||||
</script>
|
||||
|
||||
<AppHead title="Register" />
|
||||
|
||||
<Form
|
||||
{...store.form()}
|
||||
resetOnSuccess={['password', 'password_confirmation']}
|
||||
class="flex flex-col gap-6"
|
||||
>
|
||||
{#snippet children({ errors, processing })}
|
||||
<div class="grid gap-6">
|
||||
<div class="grid gap-2">
|
||||
<Label for="name">Name</Label>
|
||||
<Input
|
||||
id="name"
|
||||
type="text"
|
||||
required
|
||||
autocomplete="name"
|
||||
name="name"
|
||||
placeholder="Full name"
|
||||
/>
|
||||
<InputError message={errors.name} />
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="email">Email address</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
required
|
||||
autocomplete="email"
|
||||
name="email"
|
||||
placeholder="email@example.com"
|
||||
/>
|
||||
<InputError message={errors.email} />
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="password">Password</Label>
|
||||
<PasswordInput
|
||||
id="password"
|
||||
required
|
||||
autocomplete="new-password"
|
||||
name="password"
|
||||
placeholder="Password"
|
||||
/>
|
||||
<InputError message={errors.password} />
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="password_confirmation">Confirm password</Label>
|
||||
<PasswordInput
|
||||
id="password_confirmation"
|
||||
required
|
||||
autocomplete="new-password"
|
||||
name="password_confirmation"
|
||||
placeholder="Confirm password"
|
||||
/>
|
||||
<InputError message={errors.password_confirmation} />
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
class="mt-2 w-full"
|
||||
disabled={processing}
|
||||
data-test="register-user-button"
|
||||
>
|
||||
{#if processing}<Spinner />{/if}
|
||||
Create account
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="text-center text-sm text-muted-foreground">
|
||||
Already have an account?
|
||||
<TextLink href={login()} class="underline underline-offset-4">
|
||||
Log in
|
||||
</TextLink>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Form>
|
||||
@@ -0,0 +1,86 @@
|
||||
<script module lang="ts">
|
||||
export const layout = {
|
||||
title: 'Reset password',
|
||||
description: 'Please enter your new password below',
|
||||
};
|
||||
</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 { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
import { update } from '@/routes/password';
|
||||
|
||||
let {
|
||||
token,
|
||||
email,
|
||||
}: {
|
||||
token: string;
|
||||
email: string;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<AppHead title="Reset password" />
|
||||
|
||||
<Form
|
||||
{...update.form()}
|
||||
transform={(data) => ({ ...data, token, email })}
|
||||
resetOnSuccess={['password', 'password_confirmation']}
|
||||
>
|
||||
{#snippet children({ errors, processing })}
|
||||
<div class="grid gap-6">
|
||||
<div class="grid gap-2">
|
||||
<Label for="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
autocomplete="email"
|
||||
value={email}
|
||||
class="mt-1 block w-full"
|
||||
readonly
|
||||
/>
|
||||
<InputError message={errors.email} class="mt-2" />
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="password">Password</Label>
|
||||
<PasswordInput
|
||||
id="password"
|
||||
name="password"
|
||||
autocomplete="new-password"
|
||||
class="mt-1 block w-full"
|
||||
placeholder="Password"
|
||||
/>
|
||||
<InputError message={errors.password} />
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="password_confirmation">Confirm password</Label>
|
||||
<PasswordInput
|
||||
id="password_confirmation"
|
||||
name="password_confirmation"
|
||||
autocomplete="new-password"
|
||||
class="mt-1 block w-full"
|
||||
placeholder="Confirm password"
|
||||
/>
|
||||
<InputError message={errors.password_confirmation} />
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
class="mt-4 w-full"
|
||||
disabled={processing}
|
||||
data-test="reset-password-button"
|
||||
>
|
||||
{#if processing}<Spinner />{/if}
|
||||
Reset password
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Form>
|
||||
@@ -0,0 +1,123 @@
|
||||
<script lang="ts">
|
||||
import { Form, setLayoutProps } from '@inertiajs/svelte';
|
||||
import AppHead from '@/components/AppHead.svelte';
|
||||
import InputError from '@/components/InputError.svelte';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import {
|
||||
InputOTP,
|
||||
InputOTPGroup,
|
||||
InputOTPSlot,
|
||||
} from '@/components/ui/input-otp';
|
||||
import { store } from '@/routes/two-factor/login';
|
||||
import type { TwoFactorConfigContent } from '@/types';
|
||||
|
||||
let showRecoveryInput = $state(false);
|
||||
let code = $state('');
|
||||
|
||||
const authConfigContent: TwoFactorConfigContent = $derived.by(() => {
|
||||
if (showRecoveryInput) {
|
||||
return {
|
||||
title: 'Recovery code',
|
||||
description:
|
||||
'Please confirm access to your account by entering one of your emergency recovery codes.',
|
||||
buttonText: 'login using an authentication code',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: 'Authentication code',
|
||||
description:
|
||||
'Enter the authentication code provided by your authenticator application.',
|
||||
buttonText: 'login using a recovery code',
|
||||
};
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
setLayoutProps({
|
||||
title: authConfigContent.title,
|
||||
description: authConfigContent.description,
|
||||
});
|
||||
});
|
||||
|
||||
function toggleRecoveryMode(clearErrors: () => void) {
|
||||
showRecoveryInput = !showRecoveryInput;
|
||||
clearErrors();
|
||||
code = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<AppHead title="Two-factor authentication" />
|
||||
|
||||
<div class="space-y-6">
|
||||
{#if !showRecoveryInput}
|
||||
<Form
|
||||
{...store.form()}
|
||||
class="space-y-4"
|
||||
resetOnError
|
||||
onError={() => (code = '')}
|
||||
>
|
||||
{#snippet children({ errors, processing, clearErrors })}
|
||||
<input type="hidden" name="code" value={code} />
|
||||
<div
|
||||
class="flex flex-col items-center justify-center space-y-3 text-center"
|
||||
>
|
||||
<div class="flex w-full items-center justify-center">
|
||||
<InputOTP
|
||||
id="otp"
|
||||
bind:value={code}
|
||||
maxlength={6}
|
||||
disabled={processing}
|
||||
>
|
||||
<InputOTPGroup>
|
||||
{#each { length: 6 } as _, i (i)}
|
||||
<InputOTPSlot index={i} />
|
||||
{/each}
|
||||
</InputOTPGroup>
|
||||
</InputOTP>
|
||||
</div>
|
||||
<InputError message={errors.code} />
|
||||
</div>
|
||||
<Button type="submit" class="w-full" disabled={processing}
|
||||
>Continue</Button
|
||||
>
|
||||
<div class="text-center text-sm text-muted-foreground">
|
||||
<span>or you can </span>
|
||||
<button
|
||||
type="button"
|
||||
class="text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500"
|
||||
onclick={() => toggleRecoveryMode(clearErrors)}
|
||||
>
|
||||
{authConfigContent.buttonText}
|
||||
</button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Form>
|
||||
{:else}
|
||||
<Form {...store.form()} class="space-y-4" resetOnError>
|
||||
{#snippet children({ errors, processing, clearErrors })}
|
||||
<Input
|
||||
name="recovery_code"
|
||||
type="text"
|
||||
placeholder="Enter recovery code"
|
||||
required
|
||||
/>
|
||||
<InputError message={errors.recovery_code} />
|
||||
<Button type="submit" class="w-full" disabled={processing}
|
||||
>Continue</Button
|
||||
>
|
||||
|
||||
<div class="text-center text-sm text-muted-foreground">
|
||||
<span>or you can </span>
|
||||
<button
|
||||
type="button"
|
||||
class="text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500"
|
||||
onclick={() => toggleRecoveryMode(clearErrors)}
|
||||
>
|
||||
{authConfigContent.buttonText}
|
||||
</button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Form>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,45 @@
|
||||
<script module lang="ts">
|
||||
export const layout = {
|
||||
title: 'Verify email',
|
||||
description:
|
||||
'Please verify your email address by clicking on the link we just emailed to you.',
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { Form } from '@inertiajs/svelte';
|
||||
import AppHead from '@/components/AppHead.svelte';
|
||||
import TextLink from '@/components/TextLink.svelte';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Spinner } from '@/components/ui/spinner';
|
||||
import { logout } from '@/routes';
|
||||
import { send } from '@/routes/verification';
|
||||
|
||||
let {
|
||||
status = '',
|
||||
}: {
|
||||
status?: string;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<AppHead title="Email verification" />
|
||||
|
||||
{#if status === 'verification-link-sent'}
|
||||
<div class="mb-4 text-center text-sm font-medium text-green-600">
|
||||
A new verification link has been sent to the email address you provided
|
||||
during registration.
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<Form {...send.form()} class="space-y-6 text-center">
|
||||
{#snippet children({ processing })}
|
||||
<Button type="submit" disabled={processing} variant="secondary">
|
||||
{#if processing}<Spinner />{/if}
|
||||
Resend verification email
|
||||
</Button>
|
||||
|
||||
<TextLink href={logout()} as="button" class="mx-auto block text-sm">
|
||||
Log out
|
||||
</TextLink>
|
||||
{/snippet}
|
||||
</Form>
|
||||
Reference in new issue
Block a user