summaryrefslogtreecommitdiff
path: root/packages/client/src/pages/reset-password.vue
blob: 7d008ae75cd5b4a054e2acf7c5168fc54d61b451 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<template>
<MkSpacer v-if="token" :content-max="700" :margin-min="16" :margin-max="32">
	<div class="_formRoot">
		<FormInput v-model="password" type="password" class="_formBlock">
			<template #prefix><i class="fas fa-lock"></i></template>
			<template #label>{{ i18n.ts.newPassword }}</template>
		</FormInput>
		
		<FormButton primary class="_formBlock" @click="save">{{ i18n.ts.save }}</FormButton>
	</div>
</MkSpacer>
</template>

<script lang="ts" setup>
import { onMounted } from 'vue';
import FormInput from '@/components/form/input.vue';
import FormButton from '@/components/ui/button.vue';
import * as os from '@/os';
import * as symbols from '@/symbols';
import { i18n } from '@/i18n';
import { router } from '@/router';

const props = defineProps<{
	token?: string;
}>();

let password = $ref('');

async function save() {
	await os.apiWithDialog('reset-password', {
		token: props.token,
		password: password,
	});
	router.push('/');
}

onMounted(() => {
	if (props.token == null) {
		os.popup(import('@/components/forgot-password.vue'), {}, {}, 'closed');
		router.push('/');
	}
});

defineExpose({
	[symbols.PAGE_INFO]: {
		title: i18n.ts.resetPassword,
		icon: 'fas fa-lock',
		bg: 'var(--bg)',
	},
});
</script>

<style lang="scss" scoped>

</style>