hippofish/packages/client/src/pages/reset-password.vue
ThatOneCalculator 5d06aa5f13
chore: 🚨 lint
2023-09-01 16:27:33 -07:00

77 lines
1.6 KiB
Vue

<template>
<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"
>
<template #prefix
><i class="ph-lock ph-bold ph-lg"></i
></template>
<template #label>{{ i18n.ts.newPassword }}</template>
</FormInput>
<FormButton primary class="_formBlock" @click="save">{{
i18n.ts.save
}}</FormButton>
</div>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { computed, defineAsyncComponent, onMounted, ref } from "vue";
import FormInput from "@/components/form/input.vue";
import FormButton from "@/components/MkButton.vue";
import * as os from "@/os";
import { i18n } from "@/i18n";
import { mainRouter } from "@/router";
import { definePageMetadata } from "@/scripts/page-metadata";
const props = defineProps<{
token?: string;
}>();
const password = ref("");
async function save() {
await os.apiWithDialog("reset-password", {
token: props.token,
password: password.value,
});
mainRouter.push("/");
}
onMounted(() => {
if (props.token == null) {
os.popup(
defineAsyncComponent(
() => import("@/components/MkForgotPassword.vue"),
),
{},
{},
"closed",
);
mainRouter.push("/");
}
});
const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
title: i18n.ts.resetPassword,
icon: "ph-lock ph-bold ph-lg",
});
</script>