complete Complete User Request Submission section RAD-1
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
<script setup>
|
||||
import AuthLayout from '../../layouts/AuthLayout.vue'
|
||||
import UiButton from '../../components/ui/UiButton.vue'
|
||||
import UiInput from '../../components/ui/UiInput.vue'
|
||||
import { Link } from '@inertiajs/inertia-vue3';
|
||||
import { ref } from 'vue';
|
||||
import { Inertia } from '@inertiajs/inertia';
|
||||
import { inject } from 'vue';
|
||||
import { toast } from 'vue3-toastify';
|
||||
const route = inject('route');
|
||||
const isLoading = ref(false);
|
||||
const password = ref('');
|
||||
const confirmPassword = ref('');
|
||||
|
||||
const updatePassword = () => {
|
||||
if (!password.value) {
|
||||
toast.error('لطفاً گذرواژه را وارد کنید', {
|
||||
position: 'top-right',
|
||||
rtl: true,
|
||||
theme: 'colored',
|
||||
autoClose: 3000,
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!confirmPassword.value) {
|
||||
toast.error('لطفاً تکرار گذرواژه را وارد کنید', {
|
||||
position: 'top-right',
|
||||
rtl: true,
|
||||
theme: 'colored',
|
||||
autoClose: 3000,
|
||||
})
|
||||
return
|
||||
}
|
||||
if (password.value !== confirmPassword.value) {
|
||||
toast.error('گذرواژه و تکرار گذرواژه مطابقت ندارند', {
|
||||
position: 'top-right',
|
||||
rtl: true,
|
||||
theme: 'colored',
|
||||
autoClose: 3000,
|
||||
})
|
||||
return
|
||||
}
|
||||
isLoading.value = true
|
||||
Inertia.post(route('updatePassword'), { password: password.value, password_confirmation: confirmPassword.value }, {
|
||||
onError: (errors) => {
|
||||
toast.error(errors.password || 'خطا در تغییر گذرواژه', {
|
||||
position: 'top-right',
|
||||
rtl: true,
|
||||
theme: 'colored',
|
||||
autoClose: 3000,
|
||||
})
|
||||
},
|
||||
onFinish: () => {
|
||||
isLoading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AuthLayout>
|
||||
<main class="p-9 h-auto w-[450px] max-sm:w-[90%] m-auto bg-white rounded-xl">
|
||||
<div class="grid grid-cols-a justify-start">
|
||||
<h1 class="text-[16px] font-semibold !text-dominant-800">
|
||||
{{ $t('auth.ResetPassword.title').replace('%userType%', 'پزشکان') }}
|
||||
</h1>
|
||||
<p class="!text-dominant-800 mt-1 text-[11px] font-normal">
|
||||
{{ $t('auth.ResetPassword.subtitle') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="flex content-start flex-col mt-6">
|
||||
<UiInput
|
||||
prefix-end="گذرواژه"
|
||||
type="password"
|
||||
password-display-type="asterisks"
|
||||
direction="ltr"
|
||||
class="!mb-2"
|
||||
v-model="password"
|
||||
/>
|
||||
<UiInput
|
||||
prefix-end="تکرار گذرواژه"
|
||||
type="password"
|
||||
password-display-type="asterisks"
|
||||
direction="ltr"
|
||||
v-model="confirmPassword"
|
||||
/>
|
||||
<UiButton
|
||||
severity="dominant"
|
||||
class="!mt-4"
|
||||
label="تایید و بازیابی گذرواژه"
|
||||
size="large"
|
||||
full-width
|
||||
outlined
|
||||
height="40px"
|
||||
icon-position="start"
|
||||
icon-class="!text-sm"
|
||||
:loading="isLoading"
|
||||
@click="updatePassword"
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
<template #footer>
|
||||
<Link :href="route('login')" class="text-center text-[13px] font-normal text-dominant-700 mt-6">
|
||||
بازگشت به صفحه ورود
|
||||
</Link>
|
||||
</template>
|
||||
</AuthLayout>
|
||||
</template>
|
||||
Reference in New Issue
Block a user