2021-05-04 00:05:34 -06:00
|
|
|
<template>
|
2022-06-20 02:38:49 -06:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
|
|
<MkSpacer v-if="token" :content-max="700" :margin-min="16" :margin-max="32">
|
|
|
|
<div class="_formRoot">
|
|
|
|
<FormInput v-model="password" type="password" class="_formBlock">
|
2022-11-06 18:33:52 -07:00
|
|
|
<template #prefix><i class="ph-lock"></i></template>
|
2022-06-20 02:38:49 -06:00
|
|
|
<template #label>{{ i18n.ts.newPassword }}</template>
|
|
|
|
</FormInput>
|
2022-01-02 05:35:23 -07:00
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
<FormButton primary class="_formBlock" @click="save">{{ i18n.ts.save }}</FormButton>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-05-04 00:05:34 -06:00
|
|
|
</template>
|
|
|
|
|
2022-01-15 19:02:27 -07:00
|
|
|
<script lang="ts" setup>
|
2022-05-01 07:51:07 -06:00
|
|
|
import { defineAsyncComponent, onMounted } from 'vue';
|
2022-01-02 05:35:23 -07:00
|
|
|
import FormInput from '@/components/form/input.vue';
|
2022-09-06 03:21:49 -06:00
|
|
|
import FormButton from '@/components/MkButton.vue';
|
2021-11-11 10:02:25 -07:00
|
|
|
import * as os from '@/os';
|
2022-01-15 19:02:27 -07:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 02:38:49 -06:00
|
|
|
import { mainRouter } from '@/router';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2022-01-15 19:02:27 -07:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
token?: string;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
let password = $ref('');
|
|
|
|
|
|
|
|
async function save() {
|
|
|
|
await os.apiWithDialog('reset-password', {
|
|
|
|
token: props.token,
|
|
|
|
password: password,
|
|
|
|
});
|
2022-06-20 02:38:49 -06:00
|
|
|
mainRouter.push('/');
|
2022-01-15 19:02:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
if (props.token == null) {
|
2022-08-30 09:24:33 -06:00
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/MkForgotPassword.vue')), {}, {}, 'closed');
|
2022-06-20 02:38:49 -06:00
|
|
|
mainRouter.push('/');
|
2022-01-15 19:02:27 -07:00
|
|
|
}
|
|
|
|
});
|
2021-05-04 00:05:34 -06:00
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.resetPassword,
|
2022-11-06 18:33:52 -07:00
|
|
|
icon: 'ph-lock',
|
2021-05-04 00:05:34 -06:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
</style>
|