2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-05-04 08:05:34 +02:00
|
|
|
<template>
|
2023-01-06 01:41:14 +01:00
|
|
|
<MkModalWindow
|
2023-01-05 13:04:56 +01:00
|
|
|
ref="dialog"
|
2021-05-04 08:05:34 +02:00
|
|
|
:width="370"
|
|
|
|
:height="400"
|
2024-01-30 11:53:53 +01:00
|
|
|
@close="dialog?.close()"
|
2022-01-18 15:06:16 +01:00
|
|
|
@closed="emit('closed')"
|
2021-05-04 08:05:34 +02:00
|
|
|
>
|
2022-01-28 03:39:49 +01:00
|
|
|
<template #header>{{ i18n.ts.forgotPassword }}</template>
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2023-05-24 10:29:58 +02:00
|
|
|
<MkSpacer :marginMin="20" :marginMax="28">
|
|
|
|
<form v-if="instance.enableEmail" @submit.prevent="onSubmit">
|
|
|
|
<div class="_gaps_m">
|
|
|
|
<MkInput v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" :spellcheck="false" autofocus required>
|
|
|
|
<template #label>{{ i18n.ts.username }}</template>
|
|
|
|
<template #prefix>@</template>
|
|
|
|
</MkInput>
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2023-05-24 10:29:58 +02:00
|
|
|
<MkInput v-model="email" type="email" :spellcheck="false" required>
|
|
|
|
<template #label>{{ i18n.ts.emailAddress }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._forgotPassword.enterEmail }}</template>
|
|
|
|
</MkInput>
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2023-05-24 10:29:58 +02:00
|
|
|
<MkButton type="submit" rounded :disabled="processing" primary style="margin: 0 auto;">{{ i18n.ts.send }}</MkButton>
|
|
|
|
|
|
|
|
<MkInfo>{{ i18n.ts._forgotPassword.ifNoEmail }}</MkInfo>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<div v-else>
|
|
|
|
{{ i18n.ts._forgotPassword.contactAdmin }}
|
2021-05-04 08:05:34 +02:00
|
|
|
</div>
|
2023-05-24 10:29:58 +02:00
|
|
|
</MkSpacer>
|
2023-01-06 01:41:14 +01:00
|
|
|
</MkModalWindow>
|
2021-05-04 08:05:34 +02:00
|
|
|
</template>
|
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
import { ref } from 'vue';
|
2023-01-06 01:41:14 +01:00
|
|
|
import MkModalWindow from '@/components/MkModalWindow.vue';
|
2022-09-06 11:21:49 +02:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-01-07 07:09:46 +01:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
2023-05-24 10:29:58 +02:00
|
|
|
import MkInfo from '@/components/MkInfo.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { instance } from '@/instance.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
const emit = defineEmits<{
|
2022-05-26 15:53:09 +02:00
|
|
|
(ev: 'done'): void;
|
|
|
|
(ev: 'closed'): void;
|
2022-01-18 15:06:16 +01:00
|
|
|
}>();
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const dialog = ref<InstanceType<typeof MkModalWindow>>();
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const username = ref('');
|
|
|
|
const email = ref('');
|
|
|
|
const processing = ref(false);
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
async function onSubmit() {
|
2023-12-07 06:42:09 +01:00
|
|
|
processing.value = true;
|
2022-01-18 15:06:16 +01:00
|
|
|
await os.apiWithDialog('request-reset-password', {
|
2023-12-07 06:42:09 +01:00
|
|
|
username: username.value,
|
|
|
|
email: email.value,
|
2022-01-18 15:06:16 +01:00
|
|
|
});
|
|
|
|
emit('done');
|
2024-01-30 11:53:53 +01:00
|
|
|
dialog.value?.close();
|
2022-01-18 15:06:16 +01:00
|
|
|
}
|
2021-05-04 08:05:34 +02:00
|
|
|
</script>
|