|
|
@ -20,7 +20,7 @@ definePageMeta({ |
|
|
|
let error = $ref<string | null>(null) |
|
|
|
let error = $ref<string | null>(null) |
|
|
|
let success = $ref(false) |
|
|
|
let success = $ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const valid = ref() |
|
|
|
const valid = $ref() |
|
|
|
|
|
|
|
|
|
|
|
const formValidator = ref() |
|
|
|
const formValidator = ref() |
|
|
|
|
|
|
|
|
|
|
@ -31,13 +31,23 @@ const form = reactive({ |
|
|
|
const formRules = { |
|
|
|
const formRules = { |
|
|
|
email: [ |
|
|
|
email: [ |
|
|
|
// E-mail is required |
|
|
|
// E-mail is required |
|
|
|
(v: string) => !!v || t('msg.error.signUpRules.emailReqd'), |
|
|
|
{ required: true, message: t('msg.error.signUpRules.emailReqd') }, |
|
|
|
// E-mail must be valid format |
|
|
|
// E-mail must be valid format |
|
|
|
(v: string) => isEmail(v) || t('msg.error.signUpRules.emailInvalid'), |
|
|
|
{ |
|
|
|
|
|
|
|
validator: (_: unknown, v: string) => { |
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
|
|
|
if (isEmail(v)) return resolve(true) |
|
|
|
|
|
|
|
reject(new Error(t('msg.error.signUpRules.emailInvalid'))) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
message: t('msg.error.signUpRules.emailInvalid'), |
|
|
|
|
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const resetPassword = async () => { |
|
|
|
const resetPassword = async () => { |
|
|
|
|
|
|
|
if (!valid) return |
|
|
|
|
|
|
|
|
|
|
|
error = null |
|
|
|
error = null |
|
|
|
try { |
|
|
|
try { |
|
|
|
await $api.auth.passwordForgot(form) |
|
|
|
await $api.auth.passwordForgot(form) |
|
|
@ -57,10 +67,13 @@ const resetError = () => { |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<NuxtLayout> |
|
|
|
<NuxtLayout> |
|
|
|
<v-form |
|
|
|
<a-form |
|
|
|
ref="formValidator" |
|
|
|
ref="formValidator" |
|
|
|
v-model="valid" |
|
|
|
layout="vertical" |
|
|
|
class="h-full min-h-[600px] flex justify-center items-center" |
|
|
|
:model="form" |
|
|
|
|
|
|
|
class="forgot-password h-full min-h-[600px] flex justify-center items-center" |
|
|
|
|
|
|
|
@finish="valid = true" |
|
|
|
|
|
|
|
@finish-failed="valid = false" |
|
|
|
@submit.prevent="resetPassword" |
|
|
|
@submit.prevent="resetPassword" |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="h-full w-full flex flex-col flex-wrap justify-center items-center"> |
|
|
|
<div class="h-full w-full flex flex-col flex-wrap justify-center items-center"> |
|
|
@ -91,29 +104,12 @@ const resetError = () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Transition> |
|
|
|
</Transition> |
|
|
|
|
|
|
|
|
|
|
|
<v-text-field |
|
|
|
<a-form-item :label="$t('labels.email')" name="email" :rules="formRules.email"> |
|
|
|
id="email" |
|
|
|
<a-input v-model:value="form.email" size="large" :placeholder="$t('labels.email')" @focus="resetError" /> |
|
|
|
v-model="form.email" |
|
|
|
</a-form-item> |
|
|
|
class="bg-white dark:!bg-gray-900" |
|
|
|
|
|
|
|
:rules="formRules.email" |
|
|
|
|
|
|
|
:label="$t('labels.email')" |
|
|
|
|
|
|
|
:placeholder="$t('labels.email')" |
|
|
|
|
|
|
|
:persistent-placeholder="true" |
|
|
|
|
|
|
|
type="text" |
|
|
|
|
|
|
|
@focus="resetError" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="self-center flex flex-wrap gap-4 items-center mt-4 md:mx-8 md:justify-between justify-center w-full"> |
|
|
|
<div class="self-center flex flex-wrap gap-4 items-center mt-4 md:mx-8 md:justify-between justify-center w-full"> |
|
|
|
<button |
|
|
|
<button class="submit" type="submit"> |
|
|
|
:disabled="!valid" |
|
|
|
|
|
|
|
:class="[ |
|
|
|
|
|
|
|
!valid |
|
|
|
|
|
|
|
? '!opacity-50 !cursor-default' |
|
|
|
|
|
|
|
: 'text-white bg-primary hover:(text-primary !bg-primary/75) dark:(!bg-secondary/75 hover:!bg-secondary/50)', |
|
|
|
|
|
|
|
]" |
|
|
|
|
|
|
|
class="ml-1 border-1 border-solid border-gray-300 color-transition rounded-lg p-4 bg-gray-100/50" |
|
|
|
|
|
|
|
type="submit" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<span class="flex items-center gap-2"><MdiLogin /> {{ $t('activity.sendEmail') }}</span> |
|
|
|
<span class="flex items-center gap-2"><MdiLogin /> {{ $t('activity.sendEmail') }}</span> |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
<div class="text-end prose-sm"> |
|
|
|
<div class="text-end prose-sm"> |
|
|
@ -123,6 +119,19 @@ const resetError = () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</v-form> |
|
|
|
</a-form> |
|
|
|
</NuxtLayout> |
|
|
|
</NuxtLayout> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
|
|
|
|
|
.forgot-password { |
|
|
|
|
|
|
|
.ant-input-affix-wrapper, |
|
|
|
|
|
|
|
.ant-input { |
|
|
|
|
|
|
|
@apply dark:(bg-gray-700 !text-white) !appearance-none my-1 border-1 border-solid border-primary/50 rounded; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.submit { |
|
|
|
|
|
|
|
@apply ml-1 bordered border-gray-300 rounded-lg p-4 bg-gray-100/50 text-white bg-primary hover:bg-primary/75 dark:(!bg-secondary/75 hover:!bg-secondary/50); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|