78 lines
2.9 KiB
Vue
78 lines
2.9 KiB
Vue
<script setup lang="ts">
|
|
import { Head, useForm } from '@inertiajs/vue3';
|
|
import { ShieldCheck } from 'lucide-vue-next';
|
|
import { onUnmounted } from 'vue';
|
|
import AuthFormFeedback from '@/components/AuthFormFeedback.vue';
|
|
import InputError from '@/components/InputError.vue';
|
|
import PasswordInput from '@/components/PasswordInput.vue';
|
|
import { Button } from '@/components/ui/button';
|
|
import { Label } from '@/components/ui/label';
|
|
import { useFormProtection } from '@/composables/useFormProtection';
|
|
import { useLocalization } from '@/composables/useLocalization';
|
|
import AuthFlowLayout from '@/layouts/auth/AuthFlowLayout.vue';
|
|
import { store } from '@/routes/password/confirm';
|
|
|
|
const { t } = useLocalization();
|
|
const form = useForm({ password: '' }).dontRemember('password');
|
|
const protection = useFormProtection(form, { isDirty: () => false });
|
|
const submit = (): void =>
|
|
protection.submit(store(), { onSuccess: () => form.reset() });
|
|
onUnmounted(() => form.reset());
|
|
</script>
|
|
|
|
<template>
|
|
<AuthFlowLayout
|
|
:title="t('auth.confirm.title')"
|
|
:description="t('auth.confirm.description')"
|
|
:icon="ShieldCheck"
|
|
>
|
|
<Head :title="t('auth.confirm.title')" />
|
|
<form
|
|
:action="store.url()"
|
|
method="post"
|
|
class="grid gap-5"
|
|
@submit.prevent="submit"
|
|
>
|
|
<AuthFormFeedback
|
|
:state="protection.state.value"
|
|
:response-status="protection.responseStatus.value"
|
|
:loading-title="t('auth.confirm.pending')"
|
|
@retry="submit"
|
|
/>
|
|
<div class="gap-stack grid">
|
|
<Label for="password">{{ t('auth.confirm.password') }}</Label>
|
|
<PasswordInput
|
|
id="password"
|
|
v-model="form.password"
|
|
name="password"
|
|
required
|
|
autocomplete="current-password"
|
|
autofocus
|
|
:disabled="form.processing"
|
|
:invalid="Boolean(form.errors.password)"
|
|
aria-describedby="password-hint password-error"
|
|
/>
|
|
<p
|
|
id="password-hint"
|
|
class="text-caption text-muted-foreground"
|
|
>
|
|
{{ t('auth.confirm.passwordHint') }}
|
|
</p>
|
|
<InputError
|
|
id="password-error"
|
|
:message="form.errors.password"
|
|
/>
|
|
</div>
|
|
<Button
|
|
type="submit"
|
|
class="w-full"
|
|
:loading="form.processing"
|
|
:loading-label="t('auth.confirm.pending')"
|
|
data-test="confirm-password-button"
|
|
>{{ t('auth.confirm.submit') }}</Button
|
|
>
|
|
</form>
|
|
<template #footer>{{ t('auth.confirm.footer') }}</template>
|
|
</AuthFlowLayout>
|
|
</template>
|