-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPassword.svelte
More file actions
103 lines (94 loc) · 3.98 KB
/
Password.svelte
File metadata and controls
103 lines (94 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<script lang="ts">
import { Form } from '@inertiajs/svelte';
import PasswordController from '@/actions/App/Http/Controllers/Settings/PasswordController';
import AppHead from '@/components/AppHead.svelte';
import Heading from '@/components/Heading.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 AppLayout from '@/layouts/AppLayout.svelte';
import SettingsLayout from '@/layouts/settings/Layout.svelte';
import { edit } from '@/routes/user-password';
import type { BreadcrumbItem } from '@/types';
const breadcrumbItems: BreadcrumbItem[] = [
{
title: 'Password settings',
href: edit(),
},
];
</script>
<AppHead title="Password settings" />
<AppLayout breadcrumbs={breadcrumbItems}>
<h1 class="sr-only">Password settings</h1>
<SettingsLayout>
<div class="space-y-6">
<Heading
variant="small"
title="Update password"
description="Ensure your account is using a long, random password to stay secure"
/>
<Form
{...PasswordController.update.form()}
class="space-y-6"
options={{ preserveScroll: true }}
resetOnSuccess
resetOnError={[
'password',
'password_confirmation',
'current_password',
]}
>
{#snippet children({ errors, processing, recentlySuccessful })}
<div class="grid gap-2">
<Label for="current_password">Current password</Label>
<PasswordInput
id="current_password"
name="current_password"
class="mt-1 block w-full"
autocomplete="current-password"
placeholder="Current password"
/>
<InputError message={errors.current_password} />
</div>
<div class="grid gap-2">
<Label for="password">New password</Label>
<PasswordInput
id="password"
name="password"
class="mt-1 block w-full"
autocomplete="new-password"
placeholder="New 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"
class="mt-1 block w-full"
autocomplete="new-password"
placeholder="Confirm password"
/>
<InputError message={errors.password_confirmation} />
</div>
<div class="flex items-center gap-4">
<Button
type="submit"
disabled={processing}
data-test="update-password-button"
>
Save password
</Button>
{#if recentlySuccessful}
<p class="text-sm text-neutral-600">Saved.</p>
{/if}
</div>
{/snippet}
</Form>
</div>
</SettingsLayout>
</AppLayout>