From 4454dab8a11a63dd4d5d5eac766f90ef2bbf74f5 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Tue, 20 Aug 2024 17:56:35 +0800 Subject: [PATCH] Revert "feat: support reCAPTCHA v3 captcha provider (#3130)" This reverts commit a0d6f2125ea2f376ac7f67861015b1fe1d0a4943. --- captcha/provider.go | 4 +--- web/src/Setting.js | 9 ++------- web/src/common/CaptchaWidget.js | 16 +--------------- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/captcha/provider.go b/captcha/provider.go index 499151cd..fe652d42 100644 --- a/captcha/provider.go +++ b/captcha/provider.go @@ -24,9 +24,7 @@ func GetCaptchaProvider(captchaType string) CaptchaProvider { switch captchaType { case "Default": return NewDefaultCaptchaProvider() - case "reCAPTCHA v2": - return NewReCaptchaProvider() - case "reCAPTCHA v3": + case "reCAPTCHA": return NewReCaptchaProvider() case "Aliyun Captcha": return NewAliyunCaptchaProvider() diff --git a/web/src/Setting.js b/web/src/Setting.js index a00e9ccf..d30aed8c 100644 --- a/web/src/Setting.js +++ b/web/src/Setting.js @@ -279,11 +279,7 @@ export const OtherProviderInfo = { logo: `${StaticBaseUrl}/img/captcha_default.png`, url: "https://pkg.go.dev/github.com/dchest/captcha", }, - "reCAPTCHA v2": { - logo: `${StaticBaseUrl}/img/social_recaptcha.png`, - url: "https://www.google.com/recaptcha", - }, - "reCAPTCHA v3": { + "reCAPTCHA": { logo: `${StaticBaseUrl}/img/social_recaptcha.png`, url: "https://www.google.com/recaptcha", }, @@ -1087,8 +1083,7 @@ export function getProviderTypeOptions(category) { } else if (category === "Captcha") { return ([ {id: "Default", name: "Default"}, - {id: "reCAPTCHA v2", name: "reCAPTCHA v2"}, - {id: "reCAPTCHA v3", name: "reCAPTCHA v3"}, + {id: "reCAPTCHA", name: "reCAPTCHA"}, {id: "hCaptcha", name: "hCaptcha"}, {id: "Aliyun Captcha", name: "Aliyun Captcha"}, {id: "GEETEST", name: "GEETEST"}, diff --git a/web/src/common/CaptchaWidget.js b/web/src/common/CaptchaWidget.js index bbbf920d..58523c25 100644 --- a/web/src/common/CaptchaWidget.js +++ b/web/src/common/CaptchaWidget.js @@ -27,7 +27,7 @@ export const CaptchaWidget = (props) => { useEffect(() => { switch (captchaType) { - case "reCAPTCHA v2": { + case "reCAPTCHA": { const reTimer = setInterval(() => { if (!window.grecaptcha) { loadScript("https://recaptcha.net/recaptcha/api.js"); @@ -42,20 +42,6 @@ export const CaptchaWidget = (props) => { }, 300); break; } - case "reCAPTCHA v3": { - const reTimer = setInterval(() => { - if (!window.grecaptcha) { - loadScript(`https://recaptcha.net/recaptcha/api.js?render=${siteKey}`); - } - if (window.grecaptcha && window.grecaptcha.execute) { - window.grecaptcha.execute(siteKey, {action: "submit"}).then(function(token) { - onChange(token); - }); - clearInterval(reTimer); - } - }, 300); - break; - } case "hCaptcha": { const hTimer = setInterval(() => { if (!window.hcaptcha) {