This repository has been archived on 2022-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
IcyNet.eu/src/script/component/UserLockModal.vue

51 lines
1.3 KiB
Vue

<template lang="pug">
modal(:show='show', @close='close')
.modal-header
h3 Lock User
.modal-body.aligned-form
.alert.alert-danger(v-if='error') {{ error }}
p Are you sure you want to lock this user?
p This user will not be able to log in and will not be considered a registered user.
p This action cannot be reverted (user records will be overwritten).
.modal-footer.text-right
button.btn.btn-danger(@click='submit')
i.fas.fa-fw.fa-lock
|&nbsp;Yes
button.btn.btn-secondary(@click='close') No
</template>
<script type="text/javascript">
import Modal from './Modal.vue'
const csrfToken = document.querySelector('meta[name="csrf-token"]').content
export default {
props: ['show', 'id'],
data: function () {
return {
error: ''
}
},
components: {
Modal
},
methods: {
close: function () {
this.$emit('close')
this.error = ''
},
submit: function () {
this.$http.post('/admin/api/user/lock', {
user_id: this.id,
csrf: csrfToken
}).then(data => {
this.close()
this.$root.$emit('reload_users')
}).catch(err => {
console.error(err)
if (err.body && err.body.error) this.error = err.body.error
})
}
}
}
</script>