2018-11-02 09:05:53 -05:00
|
|
|
<template>
|
2018-11-04 01:16:05 -05:00
|
|
|
<div class="ucnffhbtogqgscfmqcymwmmupoknpfsw">
|
2018-11-02 09:05:53 -05:00
|
|
|
<ui-card>
|
2018-11-20 23:44:49 -06:00
|
|
|
<div slot="title"><fa :icon="faCertificate"/> {{ $t('verify-user') }}</div>
|
2018-11-02 09:05:53 -05:00
|
|
|
<section class="fit-top">
|
|
|
|
<ui-input v-model="verifyUsername" type="text">
|
|
|
|
<span slot="prefix">@</span>
|
|
|
|
</ui-input>
|
2018-11-20 23:44:49 -06:00
|
|
|
<ui-horizon-group>
|
|
|
|
<ui-button @click="verifyUser" :disabled="verifying">{{ $t('verify') }}</ui-button>
|
|
|
|
<ui-button @click="unverifyUser" :disabled="unverifying">{{ $t('unverify') }}</ui-button>
|
|
|
|
</ui-horizon-group>
|
2018-11-02 09:05:53 -05:00
|
|
|
</section>
|
|
|
|
</ui-card>
|
|
|
|
|
|
|
|
<ui-card>
|
2018-11-20 23:44:49 -06:00
|
|
|
<div slot="title"><fa :icon="faSnowflake"/> {{ $t('suspend-user') }}</div>
|
2018-11-02 09:05:53 -05:00
|
|
|
<section class="fit-top">
|
|
|
|
<ui-input v-model="suspendUsername" type="text">
|
|
|
|
<span slot="prefix">@</span>
|
|
|
|
</ui-input>
|
2018-11-20 23:44:49 -06:00
|
|
|
<ui-horizon-group>
|
|
|
|
<ui-button @click="suspendUser" :disabled="suspending">{{ $t('suspend') }}</ui-button>
|
|
|
|
<ui-button @click="unsuspendUser" :disabled="unsuspending">{{ $t('unsuspend') }}</ui-button>
|
|
|
|
</ui-horizon-group>
|
2018-11-02 09:05:53 -05:00
|
|
|
</section>
|
|
|
|
</ui-card>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2018-11-08 12:44:35 -06:00
|
|
|
import Vue from 'vue';
|
|
|
|
import i18n from '../../i18n';
|
2018-11-02 09:05:53 -05:00
|
|
|
import parseAcct from "../../../../misc/acct/parse";
|
2018-11-20 23:44:49 -06:00
|
|
|
import { faCertificate } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import { faSnowflake } from '@fortawesome/free-regular-svg-icons';
|
2018-11-02 09:05:53 -05:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-08 12:44:35 -06:00
|
|
|
i18n: i18n('admin/views/users.vue'),
|
2018-11-14 13:24:40 -06:00
|
|
|
|
2018-11-02 09:05:53 -05:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
verifyUsername: null,
|
|
|
|
verifying: false,
|
|
|
|
unverifying: false,
|
|
|
|
suspendUsername: null,
|
|
|
|
suspending: false,
|
2018-11-20 23:44:49 -06:00
|
|
|
unsuspending: false,
|
|
|
|
faCertificate, faSnowflake
|
2018-11-02 09:05:53 -05:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async verifyUser() {
|
|
|
|
this.verifying = true;
|
|
|
|
|
|
|
|
const process = async () => {
|
2018-11-14 13:24:40 -06:00
|
|
|
const user = await this.$root.api('users/show', parseAcct(this.verifyUsername));
|
|
|
|
await this.$root.api('admin/verify-user', { userId: user.id });
|
|
|
|
this.$root.alert({
|
|
|
|
type: 'success',
|
|
|
|
text: this.$t('verified')
|
|
|
|
});
|
2018-11-02 09:05:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
await process().catch(e => {
|
2018-11-14 13:24:40 -06:00
|
|
|
this.$root.alert({
|
|
|
|
type: 'error',
|
|
|
|
text: e.toString()
|
|
|
|
});
|
2018-11-02 09:05:53 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
this.verifying = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
async unverifyUser() {
|
|
|
|
this.unverifying = true;
|
|
|
|
|
|
|
|
const process = async () => {
|
2018-11-20 23:44:49 -06:00
|
|
|
const user = await this.$root.api('users/show', parseAcct(this.verifyUsername));
|
2018-11-14 13:24:40 -06:00
|
|
|
await this.$root.api('admin/unverify-user', { userId: user.id });
|
|
|
|
this.$root.alert({
|
|
|
|
type: 'success',
|
|
|
|
text: this.$t('unverified')
|
|
|
|
});
|
2018-11-02 09:05:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
await process().catch(e => {
|
2018-11-14 13:24:40 -06:00
|
|
|
this.$root.alert({
|
|
|
|
type: 'error',
|
|
|
|
text: e.toString()
|
|
|
|
});
|
2018-11-02 09:05:53 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
this.unverifying = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
async suspendUser() {
|
|
|
|
this.suspending = true;
|
|
|
|
|
|
|
|
const process = async () => {
|
2018-11-14 13:24:40 -06:00
|
|
|
const user = await this.$root.api('users/show', parseAcct(this.suspendUsername));
|
|
|
|
await this.$root.api('admin/suspend-user', { userId: user.id });
|
|
|
|
this.$root.alert({
|
|
|
|
type: 'success',
|
|
|
|
text: this.$t('suspended')
|
|
|
|
});
|
2018-11-02 09:05:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
await process().catch(e => {
|
2018-11-14 13:24:40 -06:00
|
|
|
this.$root.alert({
|
|
|
|
type: 'error',
|
|
|
|
text: e.toString()
|
|
|
|
});
|
2018-11-02 09:05:53 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
this.suspending = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
async unsuspendUser() {
|
|
|
|
this.unsuspending = true;
|
|
|
|
|
|
|
|
const process = async () => {
|
2018-11-20 23:44:49 -06:00
|
|
|
const user = await this.$root.api('users/show', parseAcct(this.suspendUsername));
|
2018-11-14 13:24:40 -06:00
|
|
|
await this.$root.api('admin/unsuspend-user', { userId: user.id });
|
|
|
|
this.$root.alert({
|
|
|
|
type: 'success',
|
|
|
|
text: this.$t('unsuspended')
|
|
|
|
});
|
2018-11-02 09:05:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
await process().catch(e => {
|
2018-11-14 13:24:40 -06:00
|
|
|
this.$root.alert({
|
|
|
|
type: 'error',
|
|
|
|
text: e.toString()
|
|
|
|
});
|
2018-11-02 09:05:53 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
this.unsuspending = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2018-11-04 01:16:05 -05:00
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.ucnffhbtogqgscfmqcymwmmupoknpfsw
|
|
|
|
@media (min-width 500px)
|
|
|
|
padding 16px
|
|
|
|
|
|
|
|
</style>
|