2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-05-04 08:05:34 +02:00
|
|
|
<template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-19 09:20:53 +02:00
|
|
|
<MkSpacer v-if="token" :contentMax="700" :marginMin="16" :marginMax="32">
|
2023-01-06 05:40:17 +01:00
|
|
|
<div class="_gaps_m">
|
2023-01-07 07:09:46 +01:00
|
|
|
<MkInput v-model="password" type="password">
|
2022-12-19 11:01:30 +01:00
|
|
|
<template #prefix><i class="ti ti-lock"></i></template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<template #label>{{ i18n.ts.newPassword }}</template>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkInput>
|
2023-07-08 00:08:16 +02:00
|
|
|
|
2023-01-06 01:41:14 +01:00
|
|
|
<MkButton primary @click="save">{{ i18n.ts.save }}</MkButton>
|
2022-06-20 10:38:49 +02:00
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-05-04 08:05:34 +02:00
|
|
|
</template>
|
|
|
|
|
2022-01-16 03:02:27 +01:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
import { defineAsyncComponent, onMounted, ref, computed } from 'vue';
|
2023-01-07 07:09:46 +01:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
2023-01-06 01:41:14 +01:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { mainRouter } from '@/router.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2022-01-16 03:02:27 +01:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
token?: string;
|
|
|
|
}>();
|
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const password = ref('');
|
2022-01-16 03:02:27 +01:00
|
|
|
|
|
|
|
async function save() {
|
|
|
|
await os.apiWithDialog('reset-password', {
|
|
|
|
token: props.token,
|
2023-12-07 06:42:09 +01:00
|
|
|
password: password.value,
|
2022-01-16 03:02:27 +01:00
|
|
|
});
|
2022-06-20 10:38:49 +02:00
|
|
|
mainRouter.push('/');
|
2022-01-16 03:02:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
if (props.token == null) {
|
2022-08-30 17:24:33 +02:00
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/MkForgotPassword.vue')), {}, {}, 'closed');
|
2022-06-20 10:38:49 +02:00
|
|
|
mainRouter.push('/');
|
2022-01-16 03:02:27 +01:00
|
|
|
}
|
|
|
|
});
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.resetPassword,
|
2022-12-19 11:01:30 +01:00
|
|
|
icon: 'ti ti-lock',
|
2021-05-04 08:05:34 +02:00
|
|
|
});
|
|
|
|
</script>
|