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
|
|
|
|
2022-01-18 14:06:16 +00:00
|
|
|
<form v-if="instance.enableEmail" class="bafeceda" @submit.prevent="onSubmit">
|
2023-01-05 12:04:56 +00:00
|
|
|
<div class="main _autoGap">
|
|
|
|
<MkInput v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" :spellcheck="false" autofocus required>
|
2022-01-28 02:39:49 +00:00
|
|
|
<template #label>{{ i18n.ts.username }}</template>
|
2021-05-04 06:05:34 +00:00
|
|
|
<template #prefix>@</template>
|
|
|
|
</MkInput>
|
|
|
|
|
2023-01-05 12:04:56 +00:00
|
|
|
<MkInput v-model="email" type="email" :spellcheck="false" required>
|
2022-01-28 02:39:49 +00:00
|
|
|
<template #label>{{ i18n.ts.emailAddress }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._forgotPassword.enterEmail }}</template>
|
2021-05-04 06:05:34 +00:00
|
|
|
</MkInput>
|
|
|
|
|
2023-01-05 12:04:56 +00:00
|
|
|
<MkButton type="submit" :disabled="processing" primary style="margin: 0 auto;">{{ i18n.ts.send }}</MkButton>
|
2021-05-04 06:05:34 +00:00
|
|
|
</div>
|
2021-10-31 10:19:28 +00:00
|
|
|
<div class="sub">
|
2022-01-28 02:39:49 +00:00
|
|
|
<MkA to="/about" class="_link">{{ i18n.ts._forgotPassword.ifNoEmail }}</MkA>
|
2021-05-04 06:05:34 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
2022-01-18 14:06:16 +00:00
|
|
|
<div v-else class="bafecedb">
|
2022-01-28 02:39:49 +00:00
|
|
|
{{ i18n.ts._forgotPassword.contactAdmin }}
|
2021-05-04 06:05:34 +00:00
|
|
|
</div>
|
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';
|
2021-11-11 17:02:25 +00:00
|
|
|
import MkInput from '@/components/form/input.vue';
|
|
|
|
import * as os from '@/os';
|
2022-01-18 14:06:16 +00:00
|
|
|
import { instance } from '@/instance';
|
|
|
|
import { i18n } from '@/i18n';
|
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>
|
2021-10-31 10:19:28 +00:00
|
|
|
|
2022-12-27 09:29:39 +00:00
|
|
|
<style lang="scss" scoped>
|
2021-10-31 10:19:28 +00:00
|
|
|
.bafeceda {
|
|
|
|
> .main {
|
|
|
|
padding: 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .sub {
|
|
|
|
border-top: solid 0.5px var(--divider);
|
|
|
|
padding: 24px;
|
|
|
|
}
|
|
|
|
}
|
2022-01-18 14:06:16 +00:00
|
|
|
|
|
|
|
.bafecedb {
|
|
|
|
padding: 24px;
|
|
|
|
}
|
2021-10-31 10:19:28 +00:00
|
|
|
</style>
|