feat(users): adds in client password matching validation
This commit is contained in:
@@ -87,7 +87,7 @@
|
|||||||
required
|
required
|
||||||
type="password"
|
type="password"
|
||||||
>
|
>
|
||||||
{{ form_field_validation(FORM_ERRORS['REQUIRED'] + " " + FORM_ERRORS['PASSWORD_LENGTH']) }}
|
{{ form_field_validation(FORM_ERRORS['REQUIRED'] + " " + FORM_ERRORS['PASSWORD_LENGTH'] + " " + FORM_ERRORS['MUST_MATCH_PASSWORD']) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label class="form-label" for="address">Address</label>
|
<label class="form-label" for="address">Address</label>
|
||||||
@@ -118,6 +118,13 @@
|
|||||||
form.classList.add('was-validated')
|
form.classList.add('was-validated')
|
||||||
}, false)
|
}, false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const password = document.getElementById("password")
|
||||||
|
const password_validation = document.getElementById("password-confirmation")
|
||||||
|
password.addEventListener('change', (c) => {
|
||||||
|
password_validation.setAttribute("pattern", c.target.value)
|
||||||
|
})
|
||||||
|
|
||||||
})()
|
})()
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
FORM_ERRORS = {
|
FORM_ERRORS = {
|
||||||
'REQUIRED': "This field is required.",
|
'REQUIRED': "This field is required.",
|
||||||
'PASSWORD_LENGTH': 'It must be at least 6 characters long.',
|
'PASSWORD_LENGTH': 'It must be at least 6 characters long.',
|
||||||
|
'MUST_MATCH_PASSWORD': 'It must match the given password.',
|
||||||
'VALID_EMAIL': 'Enter a valid email address.',
|
'VALID_EMAIL': 'Enter a valid email address.',
|
||||||
'PHONE_NUMBER_FORMAT': 'It can be prefixed with the "+" sign and may only contain numbers after it.',
|
'PHONE_NUMBER_FORMAT': 'It can be prefixed with the "+" sign and may only contain numbers after it.',
|
||||||
'NAME_FORMAT': 'It must be at least 2 characters long, it may only contain letters.'
|
'NAME_FORMAT': 'It must be at least 2 characters long, it may only contain letters.'
|
||||||
|
|||||||
Reference in New Issue
Block a user