mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 21:30:24 +08:00
feat: add cloudflare turnstile captcha (#1327)
* feat: add cloudflare turnstile captcha * fix: rename turnstile to cloudflare turnstile
This commit is contained in:
@ -145,6 +145,10 @@ export const OtherProviderInfo = {
|
||||
logo: `${StaticBaseUrl}/img/social_geetest.png`,
|
||||
url: "https://www.geetest.com",
|
||||
},
|
||||
"Cloudflare Turnstile": {
|
||||
logo: `${StaticBaseUrl}/img/social_cloudflare.png`,
|
||||
url: "https://www.cloudflare.com/products/turnstile/",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -695,6 +699,7 @@ export function getProviderTypeOptions(category) {
|
||||
{id: "hCaptcha", name: "hCaptcha"},
|
||||
{id: "Aliyun Captcha", name: "Aliyun Captcha"},
|
||||
{id: "GEETEST", name: "GEETEST"},
|
||||
{id: "Cloudflare Turnstile", name: "Cloudflare Turnstile"},
|
||||
]);
|
||||
} else {
|
||||
return [];
|
||||
|
@ -105,6 +105,21 @@ export const CaptchaWidget = ({captchaType, subType, siteKey, clientSecret, onCh
|
||||
}, 500);
|
||||
break;
|
||||
}
|
||||
case "Cloudflare Turnstile": {
|
||||
const tTimer = setInterval(() => {
|
||||
if (!window.turnstile) {
|
||||
loadScript("https://challenges.cloudflare.com/turnstile/v0/api.js");
|
||||
}
|
||||
if (window.turnstile && window.turnstile.render) {
|
||||
window.turnstile.render("#captcha", {
|
||||
sitekey: siteKey,
|
||||
callback: onChange,
|
||||
});
|
||||
clearInterval(tTimer);
|
||||
}
|
||||
}, 300);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user