Skip to content
Snippets Groups Projects
Commit 56f9b777 authored by Thilo Wischmeyer's avatar Thilo Wischmeyer Committed by Thilo Wischmeyer
Browse files

Added password validation error messages to registration dialog

parent 3630d69e
No related branches found
No related tags found
1 merge request!275Fix password validation error messages in registration and password change dialogs.
Pipeline #221421 failed
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
required required
:rules="[ required ]" :rules="[ required ]"
type="password" type="password"
:error-messages="passwordErrors"
@input="passwordErrors = null"
/> />
<v-text-field <v-text-field
id="input-register-password-repeat" id="input-register-password-repeat"
...@@ -105,10 +107,11 @@ export default { ...@@ -105,10 +107,11 @@ export default {
loading: false, loading: false,
acceptedGDPR: false, acceptedGDPR: false,
registrationFormIsValid: false, registrationFormIsValid: false,
required: required, required,
checkPasswordsMatch: v => v === this.credentials.password || 'Passwords do not match.', checkPasswordsMatch: v => v === this.credentials.password || 'Passwords do not match.',
errorAlert: null, errorAlert: null,
usernameErrors: null, usernameErrors: null,
passwordErrors: null,
} }
}, },
watch: { watch: {
...@@ -129,13 +132,13 @@ export default { ...@@ -129,13 +132,13 @@ export default {
registerTutor(this.credentials).then(() => { registerTutor(this.credentials).then(() => {
this.$emit('registered', this.credentials) this.$emit('registered', this.credentials)
}).catch(error => { }).catch(error => {
if (error.response && error.response.data && error.response.data.username) this.usernameErrors = error.response && error.response.data && error.response.data.username
this.usernameErrors = error.response.data.username this.passwordErrors = error.response && error.response.data && error.response.data.password
else if (!this.usernameErrors && !this.passwordErrors)
this.errorAlert = `Couldn't register a tutor account: ${error}` this.errorAlert = `Couldn't register a tutor account: ${error}`
}).finally(() => { this.loading = false }) }).finally(() => { this.loading = false })
} }
} },
} }
</script> </script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment