diff --git a/app/src/views/user/UserCreate.vue b/app/src/views/user/UserCreate.vue index ccc6e1d3..930b0639 100644 --- a/app/src/views/user/UserCreate.vue +++ b/app/src/views/user/UserCreate.vue @@ -3,7 +3,7 @@ - + + + {{ $t('passwords_too_short') }} + + + {{ $t('passwords_dont_match') }} + @@ -128,6 +136,10 @@ export default { mailbox_quota: '', password: '', confirmation: '' + }, + validation: { + password: null, + confirmation: null } } }, @@ -137,18 +149,26 @@ export default { } }, methods: { - onSubmit (e) { - console.log('submit', this.form) - e.preventDefault() + onSubmit () { const data = this.form + for (const key in this.validation) { + console.log(this.validation[key] === false, this.validation[key]) + if (this.validation[key] === false) return + } const quota = data.mailbox_quota data.mailbox_quota = parseInt(quota) ? quota + 'M' : 0 data.mail = `${data.email}@${data.domain}` + console.log('go') // TODO post data + }, + validatePassword () { + const { password, confirmation } = this.form + this.validation.password = password.length >= 8 ? null : false + this.validation.confirmation = password === confirmation ? null : false } }, created () { - this.$store.dispatch('FETCH', 'domains') + this.$store.dispatch('FETCH', { uri: 'domains' }) } } diff --git a/app/src/views/user/UserList.vue b/app/src/views/user/UserList.vue index efb12fce..ec146efe 100644 --- a/app/src/views/user/UserList.vue +++ b/app/src/views/user/UserList.vue @@ -73,7 +73,7 @@ export default { } }, async created () { - this.$store.dispatch('FETCH', 'users') + this.$store.dispatch('FETCH', { uri: 'users' }) } }