2023-07-27 14:31:52 +09:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-05-04 15:05:34 +09:00
|
|
|
<template>
|
2023-01-06 09:41:14 +09:00
|
|
|
<MkModalWindow
|
2023-01-05 21:04:56 +09:00
|
|
|
ref="dialog"
|
2021-05-04 15:05:34 +09:00
|
|
|
:width="370"
|
|
|
|
:height="400"
|
2022-01-18 23:06:16 +09:00
|
|
|
@close="dialog.close()"
|
|
|
|
@closed="emit('closed')"
|
2021-05-04 15:05:34 +09:00
|
|
|
>
|
2022-01-28 11:39:49 +09:00
|
|
|
<template #header>{{ i18n.ts.forgotPassword }}</template>
|
2021-05-04 15:05:34 +09:00
|
|
|
|
2023-05-24 17:29:58 +09: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 15:05:34 +09:00
|
|
|
|
2023-05-24 17:29:58 +09: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 15:05:34 +09:00
|
|
|
|
2023-05-24 17:29:58 +09: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 15:05:34 +09:00
|
|
|
</div>
|
2023-05-24 17:29:58 +09:00
|
|
|
</MkSpacer>
|
2023-01-06 09:41:14 +09:00
|
|
|
</MkModalWindow>
|
2021-05-04 15:05:34 +09:00
|
|
|
</template>
|
|
|
|
|
2022-01-18 23:06:16 +09:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2023-01-06 09:41:14 +09:00
|
|
|
import MkModalWindow from '@/components/MkModalWindow.vue';
|
2022-09-06 18:21:49 +09:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-01-07 15:09:46 +09:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
2023-05-24 17:29:58 +09:00
|
|
|
import MkInfo from '@/components/MkInfo.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import * as os from '@/os';
|
2022-01-18 23:06:16 +09:00
|
|
|
import { instance } from '@/instance';
|
|
|
|
import { i18n } from '@/i18n';
|
2021-05-04 15:05:34 +09:00
|
|
|
|
2022-01-18 23:06:16 +09:00
|
|
|
const emit = defineEmits<{
|
2022-05-26 22:53:09 +09:00
|
|
|
(ev: 'done'): void;
|
|
|
|
(ev: 'closed'): void;
|
2022-01-18 23:06:16 +09:00
|
|
|
}>();
|
2021-05-04 15:05:34 +09:00
|
|
|
|
2023-01-06 09:41:14 +09:00
|
|
|
let dialog: InstanceType<typeof MkModalWindow> = $ref();
|
2021-05-04 15:05:34 +09:00
|
|
|
|
2022-01-18 23:06:16 +09:00
|
|
|
let username = $ref('');
|
|
|
|
let email = $ref('');
|
|
|
|
let processing = $ref(false);
|
2021-05-04 15:05:34 +09:00
|
|
|
|
2022-01-18 23:06:16 +09:00
|
|
|
async function onSubmit() {
|
|
|
|
processing = true;
|
|
|
|
await os.apiWithDialog('request-reset-password', {
|
|
|
|
username,
|
|
|
|
email,
|
|
|
|
});
|
|
|
|
emit('done');
|
|
|
|
dialog.close();
|
|
|
|
}
|
2021-05-04 15:05:34 +09:00
|
|
|
</script>
|