mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge pull request #474 from YunoHost/merge-firstname-and-lastname
Merge firstname and lastname info
This commit is contained in:
commit
dd652296dc
5 changed files with 20 additions and 94 deletions
|
@ -356,9 +356,10 @@
|
||||||
"path": "Path",
|
"path": "Path",
|
||||||
"perform": "Perform",
|
"perform": "Perform",
|
||||||
"placeholder": {
|
"placeholder": {
|
||||||
"username": "johndoe",
|
"username": "samsmith",
|
||||||
"firstname": "John",
|
"fullname": "Sam Smith",
|
||||||
"lastname": "Doe",
|
"firstname": "Sam",
|
||||||
|
"lastname": "Smith",
|
||||||
"groupname": "My group name",
|
"groupname": "My group name",
|
||||||
"domain": "my-domain.com",
|
"domain": "my-domain.com",
|
||||||
"file": "Browse a file or drag and drop it"
|
"file": "Browse a file or drag and drop it"
|
||||||
|
|
|
@ -335,8 +335,9 @@
|
||||||
"domain": "mon-domaine.fr",
|
"domain": "mon-domaine.fr",
|
||||||
"groupname": "Le nom de mon groupe",
|
"groupname": "Le nom de mon groupe",
|
||||||
"lastname": "Dupont",
|
"lastname": "Dupont",
|
||||||
"firstname": "Jean",
|
"firstname": "Camille",
|
||||||
"username": "jeandupont",
|
"fullname": "Camille Dupont",
|
||||||
|
"username": "camilledupont",
|
||||||
"file": "Parcourir un fichier ou le faire glisser et déposer"
|
"file": "Parcourir un fichier ou le faire glisser et déposer"
|
||||||
},
|
},
|
||||||
"perform": "Exécuter",
|
"perform": "Exécuter",
|
||||||
|
|
|
@ -79,12 +79,11 @@ export default {
|
||||||
Vue.set(state.users_details, username, userData)
|
Vue.set(state.users_details, username, userData)
|
||||||
if (!state.users) return
|
if (!state.users) return
|
||||||
const user = state.users[username]
|
const user = state.users[username]
|
||||||
for (const key of ['firstname', 'lastname', 'mail']) {
|
for (const key of ['fullname', 'mail']) {
|
||||||
if (user[key] !== userData[key]) {
|
if (user[key] !== userData[key]) {
|
||||||
Vue.set(user, key, userData[key])
|
Vue.set(user, key, userData[key])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vue.set(user, 'fullname', `${userData.firstname} ${userData.lastname}`)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'UPDATE_USERS_DETAILS' (state, payload) {
|
'UPDATE_USERS_DETAILS' (state, payload) {
|
||||||
|
|
|
@ -9,26 +9,7 @@
|
||||||
<form-field v-bind="fields.username" v-model="form.username" :validation="$v.form.username" />
|
<form-field v-bind="fields.username" v-model="form.username" :validation="$v.form.username" />
|
||||||
|
|
||||||
<!-- USER FULLNAME -->
|
<!-- USER FULLNAME -->
|
||||||
<form-field
|
<form-field v-bind="fields.fullname" :validation="$v.form.fullname" v-model="form.fullname" />
|
||||||
v-bind="fields.fullname" :validation="$v.form.fullname"
|
|
||||||
>
|
|
||||||
<template #default="{ self }">
|
|
||||||
<b-input-group>
|
|
||||||
<template v-for="fname in ['firstname', 'lastname']">
|
|
||||||
<b-input-group-prepend :key="fname + 'prepend'">
|
|
||||||
<b-input-group-text :id="fname + '-label'" tag="label">
|
|
||||||
{{ self[fname].label }}
|
|
||||||
</b-input-group-text>
|
|
||||||
</b-input-group-prepend>
|
|
||||||
|
|
||||||
<input-item
|
|
||||||
v-bind="self[fname]" v-model="form.fullname[fname]" :key="fname + 'input'"
|
|
||||||
:name="self[fname].id" :aria-labelledby="fname + '-label'"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</b-input-group>
|
|
||||||
</template>
|
|
||||||
</form-field>
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<!-- USER MAIL DOMAIN -->
|
<!-- USER MAIL DOMAIN -->
|
||||||
|
@ -82,10 +63,7 @@ export default {
|
||||||
|
|
||||||
form: {
|
form: {
|
||||||
username: '',
|
username: '',
|
||||||
fullname: {
|
fullname: '',
|
||||||
firstname: '',
|
|
||||||
lastname: ''
|
|
||||||
},
|
|
||||||
domain: '',
|
domain: '',
|
||||||
password: '',
|
password: '',
|
||||||
confirmation: ''
|
confirmation: ''
|
||||||
|
@ -104,18 +82,9 @@ export default {
|
||||||
|
|
||||||
fullname: {
|
fullname: {
|
||||||
label: this.$i18n.t('user_fullname'),
|
label: this.$i18n.t('user_fullname'),
|
||||||
id: 'fullname',
|
|
||||||
props: {
|
props: {
|
||||||
firstname: {
|
id: 'fullname',
|
||||||
id: 'firstname',
|
placeholder: this.$i18n.t('placeholder.fullname')
|
||||||
label: this.$i18n.t('common.firstname'),
|
|
||||||
placeholder: this.$i18n.t('placeholder.firstname')
|
|
||||||
},
|
|
||||||
lastname: {
|
|
||||||
id: 'lastname',
|
|
||||||
label: this.$i18n.t('common.lastname'),
|
|
||||||
placeholder: this.$i18n.t('placeholder.lastname')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -156,10 +125,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
username: { required, alphalownum_, notInUsers: unique(this.userNames) },
|
username: { required, alphalownum_, notInUsers: unique(this.userNames) },
|
||||||
fullname: {
|
fullname: { required, name },
|
||||||
firstname: { required, name },
|
|
||||||
lastname: { required, name }
|
|
||||||
},
|
|
||||||
domain: { required },
|
domain: { required },
|
||||||
password: { required, passwordLenght: minLength(8) },
|
password: { required, passwordLenght: minLength(8) },
|
||||||
confirmation: { required, passwordMatch: sameAs('password') }
|
confirmation: { required, passwordMatch: sameAs('password') }
|
||||||
|
@ -189,10 +155,6 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
#lastname-label {
|
|
||||||
border-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-select {
|
.custom-select {
|
||||||
flex-basis: 40%;
|
flex-basis: 40%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,26 +8,9 @@
|
||||||
<!-- USERNAME (disabled) -->
|
<!-- USERNAME (disabled) -->
|
||||||
<form-field v-bind="fields.username" />
|
<form-field v-bind="fields.username" />
|
||||||
|
|
||||||
<!-- USER FULLNAME (FIXME quite a mess, but will be removed)-->
|
<!-- USER FULLNAME -->
|
||||||
<form-field v-bind="fields.fullname" :validation="$v.form.fullname">
|
<form-field v-bind="fields.fullname" v-model="form.fullname" :validation="$v.form.fullname" />
|
||||||
<template #default="{ self }">
|
|
||||||
<b-input-group>
|
|
||||||
<template v-for="name_ in ['firstname', 'lastname']">
|
|
||||||
<b-input-group-prepend :key="name_ + 'prepend'">
|
|
||||||
<b-input-group-text :id="name_ + '-label'" tag="label">
|
|
||||||
{{ self[name_].label }}
|
|
||||||
</b-input-group-text>
|
|
||||||
</b-input-group-prepend>
|
|
||||||
|
|
||||||
<input-item
|
|
||||||
v-bind="self[name_]" v-model.trim="form.fullname[name_]" :key="name_ + 'input'"
|
|
||||||
:name="self[name_].id" :aria-labelledby="name_ + '-label'"
|
|
||||||
:state="$v.form.fullname[name_].$invalid && $v.form.fullname.$anyDirty ? false : null"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</b-input-group>
|
|
||||||
</template>
|
|
||||||
</form-field>
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<!-- USER EMAIL -->
|
<!-- USER EMAIL -->
|
||||||
|
@ -137,7 +120,7 @@ export default {
|
||||||
],
|
],
|
||||||
|
|
||||||
form: {
|
form: {
|
||||||
fullname: { firstname: '', lastname: '' },
|
fullname: '',
|
||||||
mail: { localPart: '', separator: '@', domain: '' },
|
mail: { localPart: '', separator: '@', domain: '' },
|
||||||
mailbox_quota: '',
|
mailbox_quota: '',
|
||||||
mail_aliases: [],
|
mail_aliases: [],
|
||||||
|
@ -157,18 +140,9 @@ export default {
|
||||||
|
|
||||||
fullname: {
|
fullname: {
|
||||||
label: this.$i18n.t('user_fullname'),
|
label: this.$i18n.t('user_fullname'),
|
||||||
id: 'fullname',
|
|
||||||
props: {
|
props: {
|
||||||
firstname: {
|
id: 'fullname',
|
||||||
id: 'firstname',
|
placeholder: this.$i18n.t('placeholder.fullname')
|
||||||
label: this.$i18n.t('common.firstname'),
|
|
||||||
placeholder: this.$i18n.t('placeholder.firstname')
|
|
||||||
},
|
|
||||||
lastname: {
|
|
||||||
id: 'lastname',
|
|
||||||
label: this.$i18n.t('common.lastname'),
|
|
||||||
placeholder: this.$i18n.t('placeholder.lastname')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -220,10 +194,7 @@ export default {
|
||||||
|
|
||||||
validations: {
|
validations: {
|
||||||
form: {
|
form: {
|
||||||
fullname: {
|
fullname: { required, name },
|
||||||
firstname: { required, name },
|
|
||||||
lastname: { required, name }
|
|
||||||
},
|
|
||||||
mail: {
|
mail: {
|
||||||
localPart: { required, email: emailLocalPart }
|
localPart: { required, email: emailLocalPart }
|
||||||
},
|
},
|
||||||
|
@ -246,11 +217,7 @@ export default {
|
||||||
this.fields.mail.props.choices = this.domainsAsChoices
|
this.fields.mail.props.choices = this.domainsAsChoices
|
||||||
this.fields.mail_aliases.props.choices = this.domainsAsChoices
|
this.fields.mail_aliases.props.choices = this.domainsAsChoices
|
||||||
|
|
||||||
this.form.fullname = {
|
this.form.fullname = user.fullname
|
||||||
// Copy value to avoid refering to the stored user data
|
|
||||||
firstname: user.firstname.valueOf(),
|
|
||||||
lastname: user.lastname.valueOf()
|
|
||||||
}
|
|
||||||
this.form.mail = adressToFormValue(user.mail)
|
this.form.mail = adressToFormValue(user.mail)
|
||||||
if (user['mail-aliases']) {
|
if (user['mail-aliases']) {
|
||||||
this.form.mail_aliases = user['mail-aliases'].map(mail => adressToFormValue(mail))
|
this.form.mail_aliases = user['mail-aliases'].map(mail => adressToFormValue(mail))
|
||||||
|
@ -334,10 +301,6 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
#lastname-label {
|
|
||||||
border-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mail-list {
|
.mail-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-items: stretch;
|
justify-items: stretch;
|
||||||
|
|
Loading…
Add table
Reference in a new issue