diff --git a/frontend/src/api/accounts.js b/frontend/src/api/accounts.js index 5e1063140..fb39ae819 100644 --- a/frontend/src/api/accounts.js +++ b/frontend/src/api/accounts.js @@ -6,6 +6,9 @@ export default { getAll ({ domain, role }) { return repository.get(`/${resource}/`, { params: { domain, role } }) }, + getRandomPassword () { + return repository.get(`${resource}/random_password`) + }, validate (data) { return repository.post(`${resource}/validate/`, data) }, diff --git a/frontend/src/components/identities/AccountCreationForm.vue b/frontend/src/components/identities/AccountCreationForm.vue index f58b1ad86..43df12773 100644 --- a/frontend/src/components/identities/AccountCreationForm.vue +++ b/frontend/src/components/identities/AccountCreationForm.vue @@ -104,7 +104,26 @@ + > + +
{ + bus.$emit('notification', { msg: this.$gettext('Password copied to clipboard') }) + }) + }, getInitialForm () { return { aliases: [], @@ -211,7 +236,8 @@ export default { role: 'SimpleUsers', mailbox: { use_domain_quota: true - } + }, + random_password: true } }, async close (withConfirm) { @@ -242,6 +268,11 @@ export default { this.$refs[`form_${current}`].$refs.observer.setErrors(error.response.data) return } + if (next === 5 && this.account.random_password) { + accounts.getRandomPassword().then(resp => { + this.$set(this.account, 'password', resp.data.password) + }) + } this.step = next }, submit () { @@ -286,4 +317,7 @@ export default { .edit-link { text-decoration: none; } +.highligth { + background-color: #515D78; +} diff --git a/frontend/src/components/identities/AccountGeneralForm.vue b/frontend/src/components/identities/AccountGeneralForm.vue index 55d6f1827..55c23d6bf 100644 --- a/frontend/src/components/identities/AccountGeneralForm.vue +++ b/frontend/src/components/identities/AccountGeneralForm.vue @@ -5,23 +5,26 @@ rules="required" vid="username" > + + + + + -
+ + + - -
+ + diff --git a/frontend/src/components/identities/AccountRoleForm.vue b/frontend/src/components/identities/AccountRoleForm.vue index c2440aa9c..aaa5f027d 100644 --- a/frontend/src/components/identities/AccountRoleForm.vue +++ b/frontend/src/components/identities/AccountRoleForm.vue @@ -4,12 +4,23 @@ v-slot="{ errors }" rules="required" > - + + + + + + +

{{ roleLabel }}

+

{{ roleHelp }}

+ mdi-help-circle-outline +
+
+
@@ -22,24 +33,36 @@ export default { ChoiceField }, props: ['account'], + computed: { + roleLabel () { + return this.accountRoles.find(role => role.value === this.account.role).label + }, + roleHelp () { + return this.accountRoles.find(role => role.value === this.account.role).help + } + }, data () { return { accountRoles: [ { label: this.$gettext('Domain administrator'), - value: 'DomainAdmins' + value: 'DomainAdmins', + help: this.$gettext('A user with privileges on one or more domain. He will be allowed to administer mailboxes and he can also have a mailbox.') }, { label: this.$gettext('Reseller'), - value: 'Resellers' + value: 'Resellers', + help: this.$gettext('help') }, { label: this.$gettext('Simple user'), - value: 'SimpleUsers' + value: 'SimpleUsers', + help: this.$gettext('A user with no privileges but with a mailbox. He will be allowed to use all end-user features: webmail, calendar, contacts, filters.') }, { label: this.$gettext('Super administrator'), - value: 'SuperAdmins' + value: 'SuperAdmins', + help: this.$gettext('A user with all privileges, can do anything. By default, such a user does not have a mailbox so he can\'t access end-user features.') } ] } diff --git a/frontend/src/components/tools/ChoiceField.vue b/frontend/src/components/tools/ChoiceField.vue index 43c493c25..900afd2f8 100644 --- a/frontend/src/components/tools/ChoiceField.vue +++ b/frontend/src/components/tools/ChoiceField.vue @@ -1,7 +1,7 @@