Files

90 lines
2.8 KiB
Vue
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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 { Inertia } from '@inertiajs/inertia';
import { ref } from 'vue'
import { toast } from 'vue3-toastify';
const props = defineProps({
phone: String,
level: String
})
const password = ref('');
const isLoading = ref(false)
const handleLogin = () => {
if (!password.value) {
toast.error('لطفاً گذرواژه را وارد کنید', {
position: 'top-right',
rtl: true,
theme: 'colored',
autoClose: 3000,
})
return
}
isLoading.value = true
Inertia.post('/auth/login/authenticate', {
password: password.value
}, {
onSuccess: () => {
isLoading.value = false
},
onError: (errors) => {
isLoading.value = false
toast.error(errors.password || 'خطا در ورود')
}
})
}
</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.Password.title').replace('%userType%', level === 'supervisor' ? 'سرپرست' : level === 'doctor' ? 'پزشک' : 'دانپزشک') }}
</h1>
<p class="!text-dominant-800 mt-1 text-[11px] font-normal">
{{ $t('auth.Password.subtitle') }}
</p>
</div>
<div class="flex flex-col gap-2 mt-6">
<UiInput
v-model="password"
prefix-end="گذرواژه"
type="password"
password-display-type="asterisks"
direction="ltr"
/>
<UiButton
severity="dominant"
class="!mt-4"
:label="isLoading ? 'در حال ورود...' : 'تایید و ورود به حساب'"
size="large"
full-width
outlined
height="40px"
icon-position="start"
icon-class="!text-sm mt-1"
:loading="isLoading"
@click="handleLogin"
/>
</div>
</main>
<template #footer>
<Link method="post" class="text-center text-[13px] font-normal text-dominant-700 mt-6" :href="route('sendOtp')">
رمز خود را فراموش کرده‌اید؟
</Link>
</template>
</AuthLayout>
</template>