-
Notifications
You must be signed in to change notification settings - Fork 847
/
Copy pathUpdatePasswordForm.vue
83 lines (73 loc) · 2.97 KB
/
UpdatePasswordForm.vue
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
<template>
<jet-form-section @submitted="updatePassword">
<template #title>
Update Password
</template>
<template #description>
Ensure your account is using a long, random password to stay secure.
</template>
<template #form>
<div class="col-span-6 sm:col-span-4">
<jet-label for="current_password" value="Current Password" />
<jet-input id="current_password" type="password" class="mt-1 block w-full" v-model="form.current_password" ref="current_password" autocomplete="current-password" />
<jet-input-error :message="form.error('current_password')" class="mt-2" />
</div>
<div class="col-span-6 sm:col-span-4">
<jet-label for="password" value="New Password" />
<jet-input id="password" type="password" class="mt-1 block w-full" v-model="form.password" autocomplete="new-password" />
<jet-input-error :message="form.error('password')" class="mt-2" />
</div>
<div class="col-span-6 sm:col-span-4">
<jet-label for="password_confirmation" value="Confirm Password" />
<jet-input id="password_confirmation" type="password" class="mt-1 block w-full" v-model="form.password_confirmation" autocomplete="new-password" />
<jet-input-error :message="form.error('password_confirmation')" class="mt-2" />
</div>
</template>
<template #actions>
<jet-action-message :on="form.recentlySuccessful" class="mr-3">
Saved.
</jet-action-message>
<jet-button :class="{ 'opacity-25': form.processing }" :disabled="form.processing">
Save
</jet-button>
</template>
</jet-form-section>
</template>
<script>
import JetActionMessage from './../../Jetstream/ActionMessage'
import JetButton from './../../Jetstream/Button'
import JetFormSection from './../../Jetstream/FormSection'
import JetInput from './../../Jetstream/Input'
import JetInputError from './../../Jetstream/InputError'
import JetLabel from './../../Jetstream/Label'
export default {
components: {
JetActionMessage,
JetButton,
JetFormSection,
JetInput,
JetInputError,
JetLabel,
},
data() {
return {
form: this.$inertia.form({
current_password: '',
password: '',
password_confirmation: '',
}, {
bag: 'updatePassword',
}),
}
},
methods: {
updatePassword() {
this.form.put('/user/password', {
preserveScroll: true
}).then(() => {
this.$refs.current_password.focus()
})
},
},
}
</script>