2021-05-04 08:05:34 +02:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<XModalWindow
|
|
|
|
ref="dialog"
|
|
|
|
:width="370"
|
|
|
|
:height="400"
|
|
|
|
@close="dialog.close()"
|
|
|
|
@closed="emit('closed')"
|
|
|
|
>
|
|
|
|
<template #header>{{ i18n.ts.forgotPassword }}</template>
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
<form
|
|
|
|
v-if="instance.enableEmail"
|
|
|
|
class="bafeceda"
|
|
|
|
@submit.prevent="onSubmit"
|
|
|
|
>
|
|
|
|
<div class="main _formRoot">
|
|
|
|
<MkInput
|
|
|
|
v-model="username"
|
|
|
|
class="_formBlock"
|
|
|
|
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-04-08 02:01:42 +02:00
|
|
|
<MkInput
|
|
|
|
v-model="email"
|
|
|
|
class="_formBlock"
|
|
|
|
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-04-08 02:01:42 +02:00
|
|
|
<MkButton
|
|
|
|
class="_formBlock"
|
|
|
|
type="submit"
|
|
|
|
:disabled="processing"
|
|
|
|
primary
|
|
|
|
style="margin: 0 auto"
|
|
|
|
>{{ i18n.ts.send }}</MkButton
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
<div class="sub">
|
|
|
|
<MkA to="/about" class="_link">{{
|
|
|
|
i18n.ts._forgotPassword.ifNoEmail
|
|
|
|
}}</MkA>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<div v-else class="bafecedb">
|
|
|
|
{{ i18n.ts._forgotPassword.contactAdmin }}
|
2021-05-04 08:05:34 +02:00
|
|
|
</div>
|
2023-04-08 02:01:42 +02:00
|
|
|
</XModalWindow>
|
2021-05-04 08:05:34 +02:00
|
|
|
</template>
|
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
<script lang="ts" setup>
|
2023-08-12 02:44:46 +02:00
|
|
|
import { ref } from "vue";
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
import XModalWindow from "@/components/MkModalWindow.vue";
|
|
|
|
import MkButton from "@/components/MkButton.vue";
|
|
|
|
import MkInput from "@/components/form/input.vue";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { instance } from "@/instance";
|
|
|
|
import { i18n } from "@/i18n";
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2022-01-18 15:06:16 +01:00
|
|
|
const emit = defineEmits<{
|
2023-04-08 02:01:42 +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-09-02 01:27:33 +02:00
|
|
|
const dialog: InstanceType<typeof XModalWindow> = ref();
|
2021-05-04 08:05:34 +02:00
|
|
|
|
2023-09-02 01:27:33 +02: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-08-12 02:44:46 +02:00
|
|
|
processing.value = true;
|
2023-04-08 02:01:42 +02:00
|
|
|
await os.apiWithDialog("request-reset-password", {
|
2023-08-12 02:44:46 +02:00
|
|
|
username: username.value,
|
|
|
|
email: email.value,
|
2022-01-18 15:06:16 +01:00
|
|
|
});
|
2023-04-08 02:01:42 +02:00
|
|
|
emit("done");
|
2023-08-12 02:44:46 +02:00
|
|
|
dialog.value.close();
|
2022-01-18 15:06:16 +01:00
|
|
|
}
|
2021-05-04 08:05:34 +02:00
|
|
|
</script>
|
2021-10-31 11:19:28 +01:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.bafeceda {
|
|
|
|
> .main {
|
|
|
|
padding: 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .sub {
|
|
|
|
border-top: solid 0.5px var(--divider);
|
|
|
|
padding: 24px;
|
|
|
|
}
|
|
|
|
}
|
2022-01-18 15:06:16 +01:00
|
|
|
|
|
|
|
.bafecedb {
|
|
|
|
padding: 24px;
|
|
|
|
}
|
2021-10-31 11:19:28 +01:00
|
|
|
</style>
|