diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-20 14:02:11 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-20 14:09:01 +1000 |
commit | 3b9ffce42cc9cd7578776c149b75f4761eb73771 (patch) | |
tree | 0d183f1cf28708f54cdf89aaccd0d47cf8e89ffc | |
parent | Merge branch 'feat/defaultFeatures' into slowcord (diff) | |
download | server-3b9ffce42cc9cd7578776c149b75f4761eb73771.tar.xz |
Hcaptcha support on login/register
-rw-r--r-- | slowcord/login/public/css/index.css | 6 | ||||
-rw-r--r-- | slowcord/login/public/login.html | 7 | ||||
-rw-r--r-- | slowcord/login/public/register.html | 5 |
3 files changed, 17 insertions, 1 deletions
diff --git a/slowcord/login/public/css/index.css b/slowcord/login/public/css/index.css index 1fa76966..d4f5a4b4 100644 --- a/slowcord/login/public/css/index.css +++ b/slowcord/login/public/css/index.css @@ -103,4 +103,10 @@ label { margin-top: 10px; color: rgb(200, 20, 20); display: none; +} + +.h-captcha { + display: flex; + justify-content: center; + margin-top: 10px; } \ No newline at end of file diff --git a/slowcord/login/public/login.html b/slowcord/login/public/login.html index bbfbf2af..b2c1b229 100644 --- a/slowcord/login/public/login.html +++ b/slowcord/login/public/login.html @@ -41,6 +41,9 @@ href="https://discord.com/api/oauth2/authorize?client_id=991688571415175198&redirect_uri=https%3A%2F%2Fslowcord.maddy.k.vu%2Foauth%2Fdiscord&response_type=code&scope=identify%20email"> Login with Discord </a> + + <div class="h-captcha" data-sitekey="fa3163ea-79a7-4b7b-b752-b58c545906c8"></div> + <script src="https://js.hcaptcha.com/1/api.js" async defer></script> </form> </div> </div> @@ -67,11 +70,13 @@ const data = new FormData(e.target); const email = data.get("email"); const password = data.get("password"); + const hcaptcha = data.get("h-captcha-response"); await handleSubmit("/api/v9/auth/login", { login: email, password: password, - }) + captcha_key: hcaptcha, + }); }) </script> </body> diff --git a/slowcord/login/public/register.html b/slowcord/login/public/register.html index 9e7457a1..40eecdbe 100644 --- a/slowcord/login/public/register.html +++ b/slowcord/login/public/register.html @@ -47,6 +47,9 @@ href="https://discord.com/api/oauth2/authorize?client_id=991688571415175198&redirect_uri=https%3A%2F%2Fslowcord.maddy.k.vu%2Foauth%2Fdiscord&response_type=code&scope=identify%20email"> Login with Discord </a> + + <div class="h-captcha" data-sitekey="fa3163ea-79a7-4b7b-b752-b58c545906c8"></div> + <script src="https://js.hcaptcha.com/1/api.js" async defer></script> </form> </div> </div> @@ -58,6 +61,7 @@ const username = data.get("username"); const password = data.get("password"); const dob = data.get("dob"); + const hcaptcha = data.get("h-captcha-response") await handleSubmit("/api/v9/auth/register", { consent: true, @@ -65,6 +69,7 @@ username: username, password: password, date_of_birth: dob, + captcha_key: hcaptcha, }); }) </script> |