2021-05-04 01:05:34 -05:00
|
|
|
<template>
|
|
|
|
<XModalWindow ref="dialog"
|
|
|
|
:width="370"
|
|
|
|
:height="400"
|
|
|
|
@close="$refs.dialog.close()"
|
|
|
|
@closed="$emit('closed')"
|
|
|
|
>
|
|
|
|
<template #header>{{ $ts.forgotPassword }}</template>
|
|
|
|
|
2021-11-19 04:36:12 -06:00
|
|
|
<form v-if="$instance.enableEmail" class="bafeceda" @submit.prevent="onSubmit">
|
2021-10-31 05:19:28 -05:00
|
|
|
<div class="main _formRoot">
|
2021-11-19 04:36:12 -06:00
|
|
|
<MkInput v-model="username" class="_formBlock" type="text" pattern="^[a-zA-Z0-9_]+$" spellcheck="false" autofocus required>
|
2021-08-06 08:29:19 -05:00
|
|
|
<template #label>{{ $ts.username }}</template>
|
2021-05-04 01:05:34 -05:00
|
|
|
<template #prefix>@</template>
|
|
|
|
</MkInput>
|
|
|
|
|
2021-11-19 04:36:12 -06:00
|
|
|
<MkInput v-model="email" class="_formBlock" type="email" spellcheck="false" required>
|
2021-08-06 08:29:19 -05:00
|
|
|
<template #label>{{ $ts.emailAddress }}</template>
|
|
|
|
<template #caption>{{ $ts._forgotPassword.enterEmail }}</template>
|
2021-05-04 01:05:34 -05:00
|
|
|
</MkInput>
|
|
|
|
|
2021-10-31 05:19:28 -05:00
|
|
|
<MkButton class="_formBlock" type="submit" :disabled="processing" primary style="margin: 0 auto;">{{ $ts.send }}</MkButton>
|
2021-05-04 01:05:34 -05:00
|
|
|
</div>
|
2021-10-31 05:19:28 -05:00
|
|
|
<div class="sub">
|
2021-05-04 01:05:34 -05:00
|
|
|
<MkA to="/about" class="_link">{{ $ts._forgotPassword.ifNoEmail }}</MkA>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<div v-else>
|
|
|
|
{{ $ts._forgotPassword.contactAdmin }}
|
|
|
|
</div>
|
|
|
|
</XModalWindow>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import XModalWindow from '@/components/ui/modal-window.vue';
|
|
|
|
import MkButton from '@/components/ui/button.vue';
|
|
|
|
import MkInput from '@/components/form/input.vue';
|
|
|
|
import * as os from '@/os';
|
2021-05-04 01:05:34 -05:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
XModalWindow,
|
|
|
|
MkButton,
|
|
|
|
MkInput,
|
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['done', 'closed'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
username: '',
|
|
|
|
email: '',
|
|
|
|
processing: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async onSubmit() {
|
|
|
|
this.processing = true;
|
|
|
|
await os.apiWithDialog('request-reset-password', {
|
|
|
|
username: this.username,
|
|
|
|
email: this.email,
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$emit('done');
|
|
|
|
this.$refs.dialog.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2021-10-31 05:19:28 -05:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.bafeceda {
|
|
|
|
> .main {
|
|
|
|
padding: 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .sub {
|
|
|
|
border-top: solid 0.5px var(--divider);
|
|
|
|
padding: 24px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|