diff options
author | ThibG <thib@sitedethib.com> | 2020-12-10 06:27:26 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2020-12-10 09:44:16 +0100 |
commit | 9a5825f864b9e9c545e995249518bb50a74f4359 (patch) | |
tree | 4e814a622966f1b71f18c1ff41116c75f0728afc /app | |
parent | 237025b5efdd8294efb0e5e63bf6cabd84344553 (diff) |
[Glitch] Add honeypot fields and minimum fill-out time for sign-up form
Port 49eb4d4ddf61e25c5aaab89aa630ddd3c7f3c23d to glitch-soc Co-authored-by: Claire <claire.github-309c@sitedethib.com> Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/flavours/glitch/packs/public.js | 11 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/styles/forms.scss | 8 |
2 files changed, 19 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/packs/public.js b/app/javascript/flavours/glitch/packs/public.js index c74e5c9af..dccdbc8d0 100644 --- a/app/javascript/flavours/glitch/packs/public.js +++ b/app/javascript/flavours/glitch/packs/public.js @@ -151,6 +151,17 @@ function main() { target.style.display = 'block'; } }); + + // Empty the honeypot fields in JS in case something like an extension + // automatically filled them. + delegate(document, '#registration_new_user,#new_user', 'submit', () => { + ['user_website', 'user_confirm_password', 'registration_user_website', 'registration_user_confirm_password'].forEach(id => { + const field = document.getElementById(id); + if (field) { + field.value = ''; + } + }); + }); } loadPolyfills() diff --git a/app/javascript/flavours/glitch/styles/forms.scss b/app/javascript/flavours/glitch/styles/forms.scss index d53567bc3..20dc3eb82 100644 --- a/app/javascript/flavours/glitch/styles/forms.scss +++ b/app/javascript/flavours/glitch/styles/forms.scss @@ -345,6 +345,7 @@ code { input[type=number], input[type=email], input[type=password], + input[type=url], textarea { box-sizing: border-box; font-size: 16px; @@ -985,3 +986,10 @@ code { flex-direction: row; } } + +.input.user_confirm_password, +.input.user_website { + &:not(.field_with_errors) { + display: none; + } +} |