mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-06-06 20:37:32 +00:00
27140d4ffc
* add linter, prettier and typescript support for jetstream * add github actions for lint, build and typecheck * add composer install to build action * fix composer lock * add ext-intl and fixed php version * fix intl php extension install * add tip php extension to github npm build action * fix php version to 8.3.1 * change github php base action * fix primary button default type * updated typescript types from Team to Organization --------- Co-authored-by: Gregor Vostrak <gregorvostrak@Gregors-MacBook-Pro.local>
104 lines
3.5 KiB
Vue
104 lines
3.5 KiB
Vue
<script setup lang="ts">
|
|
import { ref } from 'vue';
|
|
import { useForm } from '@inertiajs/vue3';
|
|
import ActionMessage from '@/Components/ActionMessage.vue';
|
|
import FormSection from '@/Components/FormSection.vue';
|
|
import InputError from '@/Components/InputError.vue';
|
|
import InputLabel from '@/Components/InputLabel.vue';
|
|
import PrimaryButton from '@/Components/PrimaryButton.vue';
|
|
import TextInput from '@/Components/TextInput.vue';
|
|
|
|
const passwordInput = ref<HTMLElement | null>(null);
|
|
const currentPasswordInput = ref<HTMLElement | null>(null);
|
|
|
|
const form = useForm({
|
|
current_password: '',
|
|
password: '',
|
|
password_confirmation: '',
|
|
});
|
|
|
|
const updatePassword = () => {
|
|
form.put(route('user-password.update'), {
|
|
errorBag: 'updatePassword',
|
|
preserveScroll: true,
|
|
onSuccess: () => form.reset(),
|
|
onError: () => {
|
|
if (form.errors.password) {
|
|
form.reset('password', 'password_confirmation');
|
|
passwordInput.value?.focus();
|
|
}
|
|
|
|
if (form.errors.current_password) {
|
|
form.reset('current_password');
|
|
currentPasswordInput.value?.focus();
|
|
}
|
|
},
|
|
});
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<FormSection @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">
|
|
<InputLabel for="current_password" value="Current Password" />
|
|
<TextInput
|
|
id="current_password"
|
|
ref="currentPasswordInput"
|
|
v-model="form.current_password"
|
|
type="password"
|
|
class="mt-1 block w-full"
|
|
autocomplete="current-password" />
|
|
<InputError
|
|
:message="form.errors.current_password"
|
|
class="mt-2" />
|
|
</div>
|
|
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="password" value="New Password" />
|
|
<TextInput
|
|
id="password"
|
|
ref="passwordInput"
|
|
v-model="form.password"
|
|
type="password"
|
|
class="mt-1 block w-full"
|
|
autocomplete="new-password" />
|
|
<InputError :message="form.errors.password" class="mt-2" />
|
|
</div>
|
|
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel
|
|
for="password_confirmation"
|
|
value="Confirm Password" />
|
|
<TextInput
|
|
id="password_confirmation"
|
|
v-model="form.password_confirmation"
|
|
type="password"
|
|
class="mt-1 block w-full"
|
|
autocomplete="new-password" />
|
|
<InputError
|
|
:message="form.errors.password_confirmation"
|
|
class="mt-2" />
|
|
</div>
|
|
</template>
|
|
|
|
<template #actions>
|
|
<ActionMessage :on="form.recentlySuccessful" class="me-3">
|
|
Saved.
|
|
</ActionMessage>
|
|
|
|
<PrimaryButton
|
|
:class="{ 'opacity-25': form.processing }"
|
|
:disabled="form.processing">
|
|
Save
|
|
</PrimaryButton>
|
|
</template>
|
|
</FormSection>
|
|
</template>
|