From c29578dfaf9d19cc16551292208149e56677d707 Mon Sep 17 00:00:00 2001
From: HF
Date: Tue, 11 Jan 2022 10:14:08 +0100
Subject: [PATCH] make captcha more general and add captcha to signup form
---
src/actions/fetch.js | 6 +-
src/components/Alert.jsx | 4 +-
src/components/Captcha.jsx | 163 ++++++++++++++--------------
src/components/GlobalCaptcha.jsx | 62 +++++++++++
src/components/windows/Register.jsx | 60 +++++-----
src/routes/api/auth/register.js | 37 ++++++-
src/routes/api/captcha.js | 2 +-
src/styles/default.css | 10 ++
src/utils/captcha.js | 9 +-
9 files changed, 234 insertions(+), 119 deletions(-)
create mode 100644 src/components/GlobalCaptcha.jsx
diff --git a/src/actions/fetch.js b/src/actions/fetch.js
index 7a291cb..a6cd5cf 100644
--- a/src/actions/fetch.js
+++ b/src/actions/fetch.js
@@ -251,10 +251,12 @@ export function requestLogin(nameoremail, password) {
);
}
-export function requestRegistration(name, email, password) {
+export function requestRegistration(name, email, password, captcha, captchaid) {
return makeAPIPOSTRequest(
'api/auth/register',
- { name, email, password },
+ {
+ name, email, password, captcha, captchaid,
+ },
);
}
diff --git a/src/components/Alert.jsx b/src/components/Alert.jsx
index ccf4959..41ff687 100644
--- a/src/components/Alert.jsx
+++ b/src/components/Alert.jsx
@@ -6,7 +6,7 @@
import React, { useState, useEffect, useCallback } from 'react';
import { useSelector, useDispatch } from 'react-redux';
-import Captcha from './Captcha';
+import GlobalCaptcha from './GlobalCaptcha';
import { closeAlert } from '../actions';
const Alert = () => {
@@ -55,7 +55,7 @@ const Alert = () => {
{(alertType === 'captcha')
- ?
+ ?
: (