added hcaptcha to register page

This commit is contained in:
Jonathan Barrow 2021-12-19 19:19:18 -05:00
parent 6681388bcd
commit d5b32c4575
2 changed files with 5 additions and 3 deletions

View File

@ -250,14 +250,14 @@ router.get('/register', async (request, response) => {
});
router.post('/register', async (request, response) => {
const { email, username, mii_name, password, password_confirm } = request.body;
const { email, username, mii_name, password, password_confirm, 'h-captcha-response': hCaptchaResponse } = request.body;
response.cookie('email', email, { domain: '.pretendo.network' });
response.cookie('username', username, { domain: '.pretendo.network' });
response.cookie('mii_name', mii_name, { domain: '.pretendo.network' });
const apiResponse = await util.apiPostGetRequest('/v1/register', {}, {
email, username, mii_name, password, password_confirm
email, username, mii_name, password, password_confirm, hCaptchaResponse
});
if (apiResponse.statusCode !== 200) {

View File

@ -1,3 +1,4 @@
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
<link rel="stylesheet" href="/assets/css/login.css" />
<div class="wrapper">
@ -50,9 +51,10 @@
<label for="password_confirm">Confirm Password</label>
<input name="password_confirm" id="password_confirm" type="password" autocomplete="new-password" required>
</div>
<div class="h-captcha" data-sitekey="cf3fd74e-93ca-47e6-9fa0-5fc439de06d4"></div>
<div class="buttons">
<button type="submit">Register</button>
<a href="/account/login" class="register">Already have an account?</a>
<a href="/account/login" class="register">Already have an account?</a>
</div>
</form>
</div>