mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
fix: edit role from admin
This commit is contained in:
parent
32b7e35a1a
commit
7daaad2d58
2 changed files with 2 additions and 19 deletions
|
@ -31,16 +31,6 @@ v-container
|
|||
v-btn(@click='newUserDialog=false' color='error' outlined) {{$t('common.cancel')}}
|
||||
v-btn(@click='createUser' :disabled='!valid' color='primary' outlined) {{$t('common.send')}}
|
||||
|
||||
//- CHANGE ROLE
|
||||
v-dialog(v-model='changeRoleDialog' width=300)
|
||||
v-card(v-if='selected_user')
|
||||
v-card-content
|
||||
h2 {{$t('common.change_role')}}
|
||||
v-list(nav dense)
|
||||
v-list-item(v-for="role in ['admin', 'editor', 'user'].filter(r => r !== selected_user.role)" :key='role' link @click='changeRole(role)')
|
||||
v-list-item-content
|
||||
v-list-item-title {{ role }}
|
||||
|
||||
v-card-text
|
||||
//- USERS LIST
|
||||
v-data-table(
|
||||
|
@ -57,12 +47,10 @@ v-container
|
|||
template(v-slot:activator="{ on, attrs }")
|
||||
v-btn(:color='role_colors[item.role ]' v-bind='attrs' v-on="on" small label) {{ item.role }}
|
||||
v-list(width=100 nav color='secondary')
|
||||
v-list-item(v-for="role in ['admin', 'editor', 'user'].filter(r => r !== item.role)" :key='role' link @click='changeRole(role)')
|
||||
v-list-item(v-for="role in ['admin', 'editor', 'user'].filter(r => r !== item.role)" :key='role' link @click='changeRole(item, role)')
|
||||
v-list-item-content
|
||||
v-list-item-title {{ role }}
|
||||
|
||||
//- v-select(v-model="item.role" :items='["user", "editor", "admin"]' dense hide-details
|
||||
//- @change="selected => changeRole(item, selected)")
|
||||
template(v-slot:item.actions='{item}')
|
||||
v-btn(text small @click='deleteUser(item)' color='error' ) {{$t('admin.delete_user')}}
|
||||
|
||||
|
@ -84,7 +72,6 @@ export default {
|
|||
changeRoleDialog: false,
|
||||
role_colors: { admin: 'error', editor: 'secondary', user: 'success' },
|
||||
valid: false,
|
||||
selected_user: null,
|
||||
new_user: {
|
||||
email: '',
|
||||
is_admin: false
|
||||
|
@ -126,10 +113,6 @@ export default {
|
|||
user.is_active = !user.is_active
|
||||
this.$axios.$put('/user', user)
|
||||
},
|
||||
chooseRole (user) {
|
||||
this.changeRoleDialog = true
|
||||
this.selected_user = user
|
||||
},
|
||||
async changeRole (user, role) {
|
||||
// ask confirmation?
|
||||
const configMsg = user.is_admin ? 'admin.disable_admin_user_confirm' : 'admin.enable_admin_user_confirm'
|
||||
|
|
|
@ -64,7 +64,7 @@ const userController = {
|
|||
|
||||
if (!req.body.password) { delete req.body.password }
|
||||
|
||||
if ((!user.is_active && req.body.is_active) || user.recover_code) {
|
||||
if ((!user.is_active && req.body.is_active)) {
|
||||
mail.send(user.email, 'confirm', { user, config }, res.locals.settings.locale)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue