Commit 4025884b authored by vietanh-0511's avatar vietanh-0511

password_confirmation

parent 37a18de0
...@@ -33,15 +33,15 @@ ...@@ -33,15 +33,15 @@
@click:append="showPassword = !showPassword" @click:append="showPassword = !showPassword"
/> />
<v-text-field <v-text-field
v-model="confirmPassword" v-model="password_confirmation "
:error-messages="confirmPasswordErrors" :error-messages="confirmPasswordErrors"
:append-icon="showConfirmPassword ? 'mdi-eye' : 'mdi-eye-off'" :append-icon="showConfirmPassword ? 'mdi-eye' : 'mdi-eye-off'"
:type="showConfirmPassword ? 'text' : 'password'" :type="showConfirmPassword ? 'text' : 'password'"
label="confirmPassword" label="confirmPassword"
hint="At least 6 characters" hint="At least 6 characters"
required required
@input="$v.confirmPassword.$touch()" @input="$v.password_confirmation .$touch()"
@blur="$v.confirmPassword.$touch()" @blur="$v.password_confirmation .$touch()"
@click:append="showConfirmPassword = !showConfirmPassword" @click:append="showConfirmPassword = !showConfirmPassword"
/> />
<v-btn class="mr-4" type="submit"> <v-btn class="mr-4" type="submit">
...@@ -70,14 +70,14 @@ export default { ...@@ -70,14 +70,14 @@ export default {
name: { required, minLength: minLength(1), maxLength: maxLength(255) }, name: { required, minLength: minLength(1), maxLength: maxLength(255) },
email: { required, email }, email: { required, email },
password: { required, minLength: minLength(6) }, password: { required, minLength: minLength(6) },
confirmPassword: { required, sameAsPassword: sameAs('password') } password_confirmation: { required, sameAsPassword: sameAs('password') }
}, },
data: () => ({ data: () => ({
name: '', name: '',
email: '', email: '',
password: '', password: '',
confirmPassword: '', password_confirmation: '',
showPassword: false, showPassword: false,
showConfirmPassword: false showConfirmPassword: false
}), }),
...@@ -113,11 +113,11 @@ export default { ...@@ -113,11 +113,11 @@ export default {
}, },
confirmPasswordErrors () { confirmPasswordErrors () {
const errors = [] const errors = []
if (!this.$v.confirmPassword.$dirty) { if (!this.$v.password_confirmation.$dirty) {
return errors return errors
} }
!this.$v.confirmPassword.required && errors.push('Password confirmation is required') !this.$v.password_confirmation.required && errors.push('Password confirmation is required')
!this.$v.confirmPassword.sameAsPassword && errors.push('Password and confirm password does not match') !this.$v.password_confirmation.sameAsPassword && errors.push('Password and confirm password does not match')
return errors return errors
} }
}, },
...@@ -131,7 +131,7 @@ export default { ...@@ -131,7 +131,7 @@ export default {
this.name = '' this.name = ''
this.email = '' this.email = ''
this.password = '' this.password = ''
this.confirmPassword = '' this.password_confirmation = ''
}, },
async signup () { async signup () {
try { try {
...@@ -139,7 +139,7 @@ export default { ...@@ -139,7 +139,7 @@ export default {
name: this.name, name: this.name,
email: this.email, email: this.email,
password: this.password, password: this.password,
confirm_password: this.confirm_password password_confirmation: this.password_confirmation
} }
).then((resp) => { ).then((resp) => {
if (resp.data.status === 'success') { if (resp.data.status === 'success') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment