summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/views/pages/admin/admin.verify-user.vue
blob: d237a5f9c1562a25063f03bb157a1bcadd5f2149 (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
56
57
<template>
<div class="mk-admin-card">
	<header>%i18n:@verify-user%</header>
	<input v-model="username" type="text" class="ui"/>
	<button class="ui" @click="verifyUser" :disabled="verifying">%i18n:@verify%</button>
</div>
</template>

<script lang="ts">
import Vue from "vue";
import parseAcct from "../../../../../../misc/acct/parse";

export default Vue.extend({
	data() {
		return {
			username: null,
			verifying: false
		};
	},
	methods: {
		async verifyUser() {
			this.verifying = true;

			const process = async () => {
				const user = await (this as any).os.api(
					"users/show",
					parseAcct(this.username)
				);

				await (this as any).os.api("admin/verify-user", {
					userId: user.id
				});

				(this as any).os.apis.dialog({ text: "%i18n:@verified%" });
			};

			await process().catch(e => {
				(this as any).os.apis.dialog({ text: `Failed: ${e}` });
			});

			this.verifying = false;
		}
	}
});
</script>

<style lang="stylus" scoped>


header
	margin 10px 0


button
	margin 16px 0

</style>