aboutsummaryrefslogtreecommitdiff
path: root/static
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
parent49b2cf3987378971d05cdcac996c69d7f862461e (diff)
downloadthatcomputerscientist-10dccc6faa8c95b34a96cdfeae6daa335fe9b76d.tar.xz
thatcomputerscientist-10dccc6faa8c95b34a96cdfeae6daa335fe9b76d.zip
Added captcha to register page
Diffstat (limited to 'static')
-rw-r--r--static/css/main.css16
-rw-r--r--static/images/icons/button_refresh.jpegbin0 -> 26372 bytes
-rw-r--r--static/js/captcha.js15
3 files changed, 31 insertions, 0 deletions
diff --git a/static/css/main.css b/static/css/main.css
index a524db34..32afdeb8 100644
--- a/static/css/main.css
+++ b/static/css/main.css
@@ -153,6 +153,22 @@ nav > ul > li {
display: none;
}
+#captcha {
+ display: flex;
+ flex-direction: row;
+}
+
+#captcha > img:nth-child(1) {
+ height: 60px;
+ margin-right: 10px;
+}
+
+#captcha > img:nth-child(2) {
+ height: 30px;
+ transform: translateY(15px);
+ cursor: pointer;
+}
+
/* Optimize for phones */
@media only screen and (max-width: 480px) {
body {
diff --git a/static/images/icons/button_refresh.jpeg b/static/images/icons/button_refresh.jpeg
new file mode 100644
index 00000000..1d6b5567
--- /dev/null
+++ b/static/images/icons/button_refresh.jpeg
Binary files differ
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();
+});