2018-10-14 03:22:42 +00:00
|
|
|
<template lang="pug">
|
2019-04-29 00:25:19 +00:00
|
|
|
v-dialog(v-model='isShown', max-width='650', persistent)
|
2018-12-30 02:30:51 +00:00
|
|
|
v-card.wiki-form
|
2019-01-01 22:03:30 +00:00
|
|
|
.dialog-header.is-short
|
|
|
|
span New User
|
2018-10-14 03:22:42 +00:00
|
|
|
v-card-text
|
2019-04-29 00:25:19 +00:00
|
|
|
v-select(
|
2019-01-01 22:03:30 +00:00
|
|
|
:items='providers'
|
|
|
|
item-text='title'
|
|
|
|
item-value='key'
|
|
|
|
outline
|
|
|
|
prepend-icon='business'
|
|
|
|
v-model='provider'
|
|
|
|
label='Provider'
|
|
|
|
)
|
2019-04-29 00:25:19 +00:00
|
|
|
v-text-field(
|
2018-12-30 02:30:51 +00:00
|
|
|
outline
|
2018-10-14 03:22:42 +00:00
|
|
|
prepend-icon='email'
|
|
|
|
v-model='email'
|
|
|
|
label='Email Address'
|
|
|
|
ref='emailInput'
|
|
|
|
)
|
2019-04-29 00:25:19 +00:00
|
|
|
v-text-field(
|
2019-01-01 22:03:30 +00:00
|
|
|
v-if='provider === `local`'
|
2018-12-30 02:30:51 +00:00
|
|
|
outline
|
2018-10-14 03:22:42 +00:00
|
|
|
prepend-icon='lock'
|
|
|
|
append-icon='casino'
|
|
|
|
v-model='password'
|
2019-04-29 00:25:19 +00:00
|
|
|
:label='mustChangePwd ? `Temporary Password` : `Password`'
|
2018-10-14 03:22:42 +00:00
|
|
|
counter='255'
|
|
|
|
@click:append='generatePwd'
|
|
|
|
)
|
2019-04-29 00:25:19 +00:00
|
|
|
v-text-field(
|
2019-01-01 22:03:30 +00:00
|
|
|
outline
|
|
|
|
prepend-icon='person'
|
|
|
|
v-model='name'
|
|
|
|
label='Name'
|
|
|
|
)
|
2019-04-29 00:25:19 +00:00
|
|
|
v-select(
|
|
|
|
:items='groups'
|
|
|
|
item-text='name'
|
|
|
|
item-value='key'
|
|
|
|
outline
|
|
|
|
prepend-icon='people'
|
|
|
|
v-model='group'
|
|
|
|
label='Assign to Group(s)...'
|
|
|
|
clearable
|
|
|
|
multiple
|
|
|
|
)
|
|
|
|
v-divider
|
|
|
|
v-checkbox(
|
|
|
|
color='primary'
|
|
|
|
label='Require password change on first login'
|
|
|
|
v-if='provider === `local`'
|
|
|
|
v-model='mustChangePwd'
|
|
|
|
hide-details
|
|
|
|
)
|
|
|
|
v-checkbox(
|
|
|
|
color='primary'
|
|
|
|
label='Send a welcome email'
|
|
|
|
hide-details
|
|
|
|
v-model='sendWelcomeEmail'
|
|
|
|
)
|
2018-10-14 03:22:42 +00:00
|
|
|
v-card-chin
|
|
|
|
v-spacer
|
|
|
|
v-btn(flat, @click='isShown = false') Cancel
|
2019-01-01 22:03:30 +00:00
|
|
|
v-btn(color='primary', @click='newUser') Create
|
2019-04-29 00:25:19 +00:00
|
|
|
v-btn(color='primary', @click='newUser') Create and Close
|
2018-10-14 03:22:42 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import uuidv4 from 'uuid/v4'
|
|
|
|
|
2019-01-01 22:03:30 +00:00
|
|
|
import providersQuery from 'gql/admin/users/users-query-strategies.gql'
|
2019-04-29 00:25:19 +00:00
|
|
|
import groupsQuery from 'gql/admin/auth/auth-query-groups.gql'
|
2019-01-01 22:03:30 +00:00
|
|
|
|
2018-10-14 03:22:42 +00:00
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2019-01-01 22:03:30 +00:00
|
|
|
providers: [],
|
|
|
|
provider: 'local',
|
2018-10-14 03:22:42 +00:00
|
|
|
email: '',
|
|
|
|
password: '',
|
2019-04-29 00:25:19 +00:00
|
|
|
name: '',
|
|
|
|
groups: [],
|
|
|
|
group: '',
|
|
|
|
mustChangePwd: false,
|
|
|
|
sendWelcomeEmail: false
|
2018-10-14 03:22:42 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
isShown: {
|
|
|
|
get() { return this.value },
|
|
|
|
set(val) { this.$emit('input', val) }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
value(newValue, oldValue) {
|
|
|
|
if (newValue) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.emailInput.focus()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2019-01-01 22:03:30 +00:00
|
|
|
async newUser() {
|
2018-10-14 03:22:42 +00:00
|
|
|
|
|
|
|
},
|
|
|
|
generatePwd() {
|
|
|
|
this.password = uuidv4().slice(-12)
|
|
|
|
}
|
2019-01-01 22:03:30 +00:00
|
|
|
},
|
|
|
|
apollo: {
|
|
|
|
providers: {
|
|
|
|
query: providersQuery,
|
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
update: (data) => data.authentication.strategies,
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-users-strategies-refresh')
|
|
|
|
}
|
2019-04-29 00:25:19 +00:00
|
|
|
},
|
|
|
|
groups: {
|
|
|
|
query: groupsQuery,
|
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
update: (data) => data.groups.list,
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-auth-groups-refresh')
|
|
|
|
}
|
2019-01-01 22:03:30 +00:00
|
|
|
}
|
2018-10-14 03:22:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|