about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/packs/public.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-08-13 23:10:19 +0200
committerGitHub <noreply@github.com>2020-08-13 23:10:19 +0200
commit6fece522f9dca9d13ae2d4437b395a92ddb106c9 (patch)
tree882f9cf298e9dffa985f214b28a877b08cf19752 /app/javascript/flavours/glitch/packs/public.js
parent660188c9008761ae38d0e82dea841f7d90e199f9 (diff)
parent0f71372d6337f695a87c7158c52b93e49acc215d (diff)
Merge pull request #1404 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/packs/public.js')
-rw-r--r--app/javascript/flavours/glitch/packs/public.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/packs/public.js b/app/javascript/flavours/glitch/packs/public.js
index 58febcf5b..b9b588dc6 100644
--- a/app/javascript/flavours/glitch/packs/public.js
+++ b/app/javascript/flavours/glitch/packs/public.js
@@ -95,6 +95,28 @@ function main() {
       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, '#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'));