Gregniuki commited on
Commit
337ce49
1 Parent(s): 81b7be4

Update templates/register.html

Browse files
Files changed (1) hide show
  1. templates/register.html +23 -20
templates/register.html CHANGED
@@ -5,27 +5,7 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Register</title>
7
  <link rel="stylesheet" type="text/css" href="/static/style.css"> <!-- Add this line for your CSS -->
8
- <script src="https://www.google.com/recaptcha/api.js" async defer></script>
9
- <script>
10
- document.getElementById('submit-button').addEventListener('submit', function() {
11
- var username = document.getElementById('username').value;
12
- var email = document.getElementById('email').value;
13
- var password = document.getElementById('password').value;
14
- var confirmPassword = document.getElementById('confirm_password').value;
15
- var recaptcha_token = document.getElementById('recaptcha_token').value;
16
 
17
- if (username && email && password && confirmPassword && recaptcha_token) {
18
- // If the form is valid, trigger reCAPTCHA
19
- grecaptcha.execute();
20
- } else {
21
- alert("Please fill in all required fields.");
22
- }
23
- });
24
- function onSubmit(token) {
25
- document.getElementById("registration-form").submit();
26
-
27
- }
28
- </script>
29
  </head>
30
 
31
  <body>
@@ -67,6 +47,29 @@
67
 
68
 
69
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  </body>
71
 
72
  </html>
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Register</title>
7
  <link rel="stylesheet" type="text/css" href="/static/style.css"> <!-- Add this line for your CSS -->
 
 
 
 
 
 
 
 
8
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  </head>
10
 
11
  <body>
 
47
 
48
 
49
  </div>
50
+ <script src="https://www.google.com/recaptcha/api.js" async defer></script>
51
+ <script>
52
+ document.getElementById('registration-form').addEventListener('submit', function(event) {
53
+ event.preventDefault(); // Prevent the form from submitting initially
54
+
55
+ var username = document.getElementById('username').value;
56
+ var email = document.getElementById('email').value;
57
+ var password = document.getElementById('password').value;
58
+ var confirmPassword = document.getElementById('confirm_password').value;
59
+
60
+ if (username && email && password && confirmPassword) {
61
+ // Fields are filled, execute reCAPTCHA
62
+ grecaptcha.execute();
63
+ } else {
64
+ alert("Please fill in all required fields.");
65
+ }
66
+ });
67
+
68
+ function onSubmit(token) {
69
+ document.getElementById('recaptcha_token').value = token;
70
+ document.getElementById('registration-form').submit(); // Submit the form after reCAPTCHA validation
71
+ }
72
+ </script>
73
  </body>
74
 
75
  </html>