|
|
|
@ -5,12 +5,10 @@ definePageMeta({
|
|
|
|
|
requiresAuth: false, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const { api, isLoading } = useApi() |
|
|
|
|
const { api, isLoading, error } = useApi() |
|
|
|
|
|
|
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
|
|
let error = $ref<string | null>(null) |
|
|
|
|
|
|
|
|
|
let success = $ref(false) |
|
|
|
|
|
|
|
|
|
const formValidator = ref() |
|
|
|
@ -41,18 +39,13 @@ async function resetPassword() {
|
|
|
|
|
|
|
|
|
|
resetError() |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
await api.auth.passwordForgot(form) |
|
|
|
|
|
|
|
|
|
await api.auth.passwordForgot(form).then(() => { |
|
|
|
|
success = true |
|
|
|
|
} catch (e: any) { |
|
|
|
|
// todo: errors should not expose what was wrong (i.e. do not show "Password is wrong" messages) |
|
|
|
|
error = await extractSdkResponseErrorMsg(e) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function resetError() { |
|
|
|
|
if (error) error = null |
|
|
|
|
if (error.value) error.value = null |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
@ -62,7 +55,10 @@ function resetError() {
|
|
|
|
|
<div |
|
|
|
|
class="bg-white mt-[60px] relative flex flex-col justify-center gap-2 w-full max-w-[500px] mx-auto p-8 md:(rounded-lg border-1 border-gray-200 shadow-xl)" |
|
|
|
|
> |
|
|
|
|
<general-noco-icon class="color-transition hover:(ring ring-accent)" :class="[isLoading ? 'animated-bg-gradient' : '']" /> |
|
|
|
|
<LazyGeneralNocoIcon |
|
|
|
|
class="color-transition hover:(ring ring-accent)" |
|
|
|
|
:class="[isLoading ? 'animated-bg-gradient' : '']" |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<div class="self-center flex flex-col justify-center items-center text-center gap-2"> |
|
|
|
|
<h1 class="prose-2xl font-bold my-4 w-full">{{ $t('title.resetPassword') }}</h1> |
|
|
|
|