[Glitch] Add HTML form validation for the registration form
Port 22aba16386
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
parent
c32625495f
commit
411d100eb4
2 changed files with 12 additions and 1 deletions
|
@ -95,6 +95,16 @@ function main() {
|
||||||
new Rellax('.parallax', { speed: -1 });
|
new Rellax('.parallax', { speed: -1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delegate(document, '#registration_user_password_confirmation,#registration_user_password', 'input', () => {
|
||||||
|
const password = document.getElementById('registration_user_password');
|
||||||
|
const confirmation = document.getElementById('registration_user_password_confirmation');
|
||||||
|
if (password.value && password.value !== confirmation.value) {
|
||||||
|
confirmation.setCustomValidity((new IntlMessageFormat(messages['password_confirmation.mismatching'] || 'Password confirmation does not match', locale)).format());
|
||||||
|
} else {
|
||||||
|
confirmation.setCustomValidity('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));
|
delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));
|
||||||
delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));
|
delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,8 @@ code {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus:invalid:not(:placeholder-shown) {
|
&:focus:invalid:not(:placeholder-shown),
|
||||||
|
&:required:invalid:not(:placeholder-shown) {
|
||||||
border-color: lighten($error-red, 12%);
|
border-color: lighten($error-red, 12%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue