about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/packs
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-12-16 19:45:17 +0100
committerGitHub <noreply@github.com>2021-12-16 19:45:17 +0100
commit7efef7db9ed6f7b25a28166c1b75a28adbaf7cdb (patch)
treead8ebb28e0466649785afa167e8711debb271e68 /app/javascript/flavours/glitch/packs
parentd911c17f521d6b13861caa886715a50b644007a1 (diff)
parent50d62fe2e749a5ab2b2bed81d5a9449b5e733964 (diff)
Merge pull request #1648 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/packs')
-rw-r--r--app/javascript/flavours/glitch/packs/public.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/packs/public.js b/app/javascript/flavours/glitch/packs/public.js
index dccdbc8d0..a92f3d5a8 100644
--- a/app/javascript/flavours/glitch/packs/public.js
+++ b/app/javascript/flavours/glitch/packs/public.js
@@ -99,7 +99,9 @@ function main() {
     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) {
+      if (confirmation.value && confirmation.value.length > password.maxLength) {
+        confirmation.setCustomValidity((new IntlMessageFormat(messages['password_confirmation.exceeds_maxlength'] || 'Password confirmation exceeds the maximum password length', locale)).format());
+      } else 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('');
@@ -111,7 +113,9 @@ function main() {
       const confirmation = document.getElementById('user_password_confirmation');
       if (!confirmation) return;
 
-      if (password.value && password.value !== confirmation.value) {
+      if (confirmation.value && confirmation.value.length > password.maxLength) {
+        confirmation.setCustomValidity((new IntlMessageFormat(messages['password_confirmation.exceeds_maxlength'] || 'Password confirmation exceeds the maximum password length', locale)).format());
+      } else 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('');