mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 12:41:37 +01:00
[Glitch] Add client-side validation in password change forms
Port 7dc4c74265
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
parent
b6c0f1fdc6
commit
0f71372d63
1 changed files with 12 additions and 0 deletions
|
@ -105,6 +105,18 @@ function main() {
|
|||
}
|
||||
});
|
||||
|
||||
delegate(document, '#user_password,#user_password_confirmation', 'input', () => {
|
||||
const password = document.getElementById('user_password');
|
||||
const confirmation = document.getElementById('user_password_confirmation');
|
||||
if (!confirmation) return;
|
||||
|
||||
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', 'mouseout', getEmojiAnimationHandler('data-static'));
|
||||
|
||||
|
|
Loading…
Reference in a new issue