mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 13:20:19 +08:00
fix: captcha widget JS warnings (#820)
This commit is contained in:
@ -30,7 +30,7 @@ export const CaptchaWidget = ({ captchaType, siteKey, onChange }) => {
|
|||||||
if (!window.grecaptcha) {
|
if (!window.grecaptcha) {
|
||||||
loadScript("https://recaptcha.net/recaptcha/api.js");
|
loadScript("https://recaptcha.net/recaptcha/api.js");
|
||||||
}
|
}
|
||||||
if (window.grecaptcha) {
|
if (window.grecaptcha && window.grecaptcha.render) {
|
||||||
window.grecaptcha.render("captcha", {
|
window.grecaptcha.render("captcha", {
|
||||||
sitekey: siteKey,
|
sitekey: siteKey,
|
||||||
callback: onChange,
|
callback: onChange,
|
||||||
@ -44,7 +44,7 @@ export const CaptchaWidget = ({ captchaType, siteKey, onChange }) => {
|
|||||||
if (!window.hcaptcha) {
|
if (!window.hcaptcha) {
|
||||||
loadScript("https://js.hcaptcha.com/1/api.js");
|
loadScript("https://js.hcaptcha.com/1/api.js");
|
||||||
}
|
}
|
||||||
if (window.hcaptcha) {
|
if (window.hcaptcha && window.hcaptcha.render) {
|
||||||
window.hcaptcha.render("captcha", {
|
window.hcaptcha.render("captcha", {
|
||||||
sitekey: siteKey,
|
sitekey: siteKey,
|
||||||
callback: onChange,
|
callback: onChange,
|
||||||
@ -56,6 +56,7 @@ export const CaptchaWidget = ({ captchaType, siteKey, onChange }) => {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [captchaType, siteKey]);
|
}, [captchaType, siteKey]);
|
||||||
|
|
||||||
return <div id="captcha"></div>;
|
return <div id="captcha"></div>;
|
||||||
|
Reference in New Issue
Block a user