aboutsummaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-09-05 19:25:07 -0400
committerBobby <[email protected]>2022-09-05 19:25:07 -0400
commit10dccc6faa8c95b34a96cdfeae6daa335fe9b76d (patch)
tree1da99e8b123768c8a28913ed88cb1431522501cb /static/js
parent49b2cf3987378971d05cdcac996c69d7f862461e (diff)
downloadthatcomputerscientist-10dccc6faa8c95b34a96cdfeae6daa335fe9b76d.tar.xz
thatcomputerscientist-10dccc6faa8c95b34a96cdfeae6daa335fe9b76d.zip
Added captcha to register page
Diffstat (limited to 'static/js')
-rw-r--r--static/js/captcha.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/static/js/captcha.js b/static/js/captcha.js
new file mode 100644
index 00000000..93be88da
--- /dev/null
+++ b/static/js/captcha.js
@@ -0,0 +1,15 @@
+const refreshCaptchaButton = document.getElementById('refresh_captcha');
+
+refreshCaptchaButton.addEventListener('click', function() {
+ const refreshCaptchaURl = refreshCaptchaButton.getAttribute('data-refresh-captcha-url');
+
+ const xhr = new XMLHttpRequest();
+ xhr.open('GET', refreshCaptchaURl, true);
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ xhr.onload = function() {
+ const data = JSON.parse(this.responseText);
+ const captchaImage = document.getElementById('captcha_image');
+ captchaImage.src = data['captcha'];
+ }
+ xhr.send();
+});