|
14 | 14 | <link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet"> |
15 | 15 | <link rel="stylesheet" href="./auth.css"> |
16 | 16 | <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js"></script> |
| 17 | + <script src="https://hcaptcha.com/1/api.js" async defer></script> |
17 | 18 | </head> |
18 | 19 |
|
19 | 20 | <body> |
@@ -95,6 +96,9 @@ <h1>Create your Rotur account</h1> |
95 | 96 | <div class="form-group"> |
96 | 97 | <input type="password" name="confirm-password" placeholder="Confirm password" required minlength="8"> |
97 | 98 | </div> |
| 99 | + <div class="form-group" style="margin-top: 12px;"> |
| 100 | + <div class="h-captcha" data-sitekey="09def114-5bba-4ba6-8302-640aec7c1df2"></div> |
| 101 | + </div> |
98 | 102 | <button type="submit" class="btn-primary">Create Account</button> |
99 | 103 | </form> |
100 | 104 | <div style="margin-top: 16px; text-align: center;"> |
@@ -690,6 +694,17 @@ <h2 style="margin:0 0 4px; font-size:22px; font-weight:500;">Link This Account</ |
690 | 694 | const password = document.querySelector("#signup-form input[name='password']").value; |
691 | 695 | const confirmPassword = document.querySelector("#signup-form input[name='confirm-password']").value; |
692 | 696 |
|
| 697 | + const hcaptchaToken = hcaptcha.getResponse(); |
| 698 | + if (!hcaptchaToken) { |
| 699 | + submitButton.innerHTML = 'Please complete the hCaptcha'; |
| 700 | + submitButton.style.background = '#ea4335'; |
| 701 | + setTimeout(() => { |
| 702 | + submitButton.innerHTML = originalText; |
| 703 | + submitButton.style.background = ''; |
| 704 | + }, 2000); |
| 705 | + return; |
| 706 | + } |
| 707 | + |
693 | 708 | // Validation |
694 | 709 | if (password !== confirmPassword) { |
695 | 710 | submitButton.innerHTML = 'Passwords do not match'; |
@@ -726,7 +741,8 @@ <h2 style="margin:0 0 4px; font-size:22px; font-weight:500;">Link This Account</ |
726 | 741 | username: username, |
727 | 742 | email: email, |
728 | 743 | password: hash, |
729 | | - system: systemName || 'rotur' |
| 744 | + system: systemName || 'rotur', |
| 745 | + captcha: hcaptchaToken |
730 | 746 | }) |
731 | 747 | }); |
732 | 748 |
|
|
0 commit comments