diff options
| author | Bobby <[email protected]> | 2022-09-05 19:25:07 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-09-05 19:25:07 -0400 |
| commit | 10dccc6faa8c95b34a96cdfeae6daa335fe9b76d (patch) | |
| tree | 1da99e8b123768c8a28913ed88cb1431522501cb /static/js | |
| parent | 49b2cf3987378971d05cdcac996c69d7f862461e (diff) | |
| download | thatcomputerscientist-10dccc6faa8c95b34a96cdfeae6daa335fe9b76d.tar.xz thatcomputerscientist-10dccc6faa8c95b34a96cdfeae6daa335fe9b76d.zip | |
Added captcha to register page
Diffstat (limited to 'static/js')
| -rw-r--r-- | static/js/captcha.js | 15 |
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(); +}); |
