recaptcha
parent
df39e164f6
commit
5b0f168eee
|
@ -342,6 +342,7 @@ function SignUp({ notificationApi }) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [isRequesting, setIsRequesting] = useState(false);
|
const [isRequesting, setIsRequesting] = useState(false);
|
||||||
|
const recaptchaValueRef = useRef(null);
|
||||||
|
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
@ -360,19 +361,18 @@ function SignUp({ notificationApi }) {
|
||||||
.then((values) => {
|
.then((values) => {
|
||||||
setIsRequesting(true);
|
setIsRequesting(true);
|
||||||
|
|
||||||
let body = {
|
|
||||||
companyName: values.companyName,
|
|
||||||
accountName: values.accountName.toLocaleLowerCase(),
|
|
||||||
password: EncodeStringToBase64(values.password),
|
|
||||||
username: values.username,
|
|
||||||
language: i18n.language,
|
|
||||||
rememberMe: values.rememberMe,
|
|
||||||
};
|
|
||||||
|
|
||||||
myFetch({
|
myFetch({
|
||||||
url: `/user/auth/signup`,
|
url: `/user/auth/signup`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: body,
|
body: {
|
||||||
|
companyName: values.companyName,
|
||||||
|
accountName: values.accountName.toLocaleLowerCase(),
|
||||||
|
password: EncodeStringToBase64(values.password),
|
||||||
|
username: values.username,
|
||||||
|
language: i18n.language,
|
||||||
|
rememberMe: values.rememberMe,
|
||||||
|
recaptcha: recaptchaValueRef.current,
|
||||||
|
},
|
||||||
notificationApi: notificationApi,
|
notificationApi: notificationApi,
|
||||||
t: t,
|
t: t,
|
||||||
})
|
})
|
||||||
|
@ -415,11 +415,20 @@ function SignUp({ notificationApi }) {
|
||||||
|
|
||||||
<RememberMeCheckbox />
|
<RememberMeCheckbox />
|
||||||
|
|
||||||
<ReCAPTCHA
|
<Form.Item
|
||||||
style={{ paddingBottom: 16 }}
|
name="recaptcha"
|
||||||
sitekey={process.env.REACT_APP_RECAPTCHA_SITE_KEY}
|
rules={[
|
||||||
onChange={(value) => console.log("Captcha value:", value)}
|
{
|
||||||
/>
|
required: true,
|
||||||
|
message: t("common.inputRules.recaptchaRequired"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<ReCAPTCHA
|
||||||
|
sitekey={process.env.REACT_APP_RECAPTCHA_SITE_KEY}
|
||||||
|
onChange={(value) => (recaptchaValueRef.current = value)}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
Loading…
Reference in New Issue