ask confirmation to toggle admin status to an user

This commit is contained in:
lesion 2022-06-23 15:50:48 +02:00
parent 24efa270b6
commit 7255e791e8
No known key found for this signature in database
GPG key ID: 352918250B012177
3 changed files with 8 additions and 3 deletions

View file

@ -23,8 +23,8 @@
v-alert(type='info' :closable='false' :icon='mdiInformation') {{$t('admin.user_add_help')}}
v-card-actions
v-spacer
v-btn(@click='newUserDialog=false' color='error') {{$t('common.cancel')}}
v-btn(@click='createUser' :disabled='!valid' color='primary') {{$t('common.send')}}
v-btn(@click='newUserDialog=false' color='error' outlined) {{$t('common.cancel')}}
v-btn(@click='createUser' :disabled='!valid' color='primary' outlined) {{$t('common.send')}}
v-card-text
//- USERS LIST
@ -101,6 +101,9 @@ export default {
},
async toggleAdmin (user) {
try {
const configMsg = user.is_admin ? 'admin.disable_admin_user_confirm' : 'admin.enable_admin_user_confirm'
const ret = await this.$root.$confirm(configMsg, { user: user.email })
if (!ret) { return }
user.is_admin = !user.is_admin
await this.$axios.$put('/user', user)
} catch (e) {

View file

@ -174,6 +174,8 @@
"remove_admin": "Remove admin",
"disable_user_confirm": "Are you sure you want to disable {user}?",
"delete_user_confirm": "Are you sure you want to remove {user}?",
"disable_admin_user_confirm": "Are you sure to remove admin permissions from {user}?",
"enable_admin_user_confirm": "Are sure to add admin permissions to {user}",
"user_remove_ok": "User removed",
"user_create_ok": "User created",
"event_remove_ok": "Event removed",

View file

@ -33,7 +33,7 @@
color='orange') {{$t('login.not_registered')}}
v-btn(color='success'
type='submit'
type='submit' outlined
:disabled='!valid || loading' :loading='loading') {{$t('common.login')}}
</template>