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