mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-09 20:52:57 +08:00
feat: refresh inline captcha on login failure (#4108)
This commit is contained in:
@@ -20,7 +20,7 @@ import {CaptchaWidget} from "../CaptchaWidget";
|
||||
import {SafetyOutlined} from "@ant-design/icons";
|
||||
|
||||
export const CaptchaModal = (props) => {
|
||||
const {owner, name, visible, onOk, onUpdateToken, onCancel, isCurrentProvider, noModal} = props;
|
||||
const {owner, name, visible, onOk, onUpdateToken, onCancel, isCurrentProvider, noModal, innerRef} = props;
|
||||
|
||||
const [captchaType, setCaptchaType] = React.useState("none");
|
||||
const [clientId, setClientId] = React.useState("");
|
||||
@@ -59,6 +59,14 @@ export const CaptchaModal = (props) => {
|
||||
onCancel?.();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (innerRef) {
|
||||
innerRef.current = {
|
||||
loadCaptcha: loadCaptcha,
|
||||
};
|
||||
}
|
||||
}, [innerRef]);
|
||||
|
||||
const loadCaptcha = () => {
|
||||
UserBackend.getCaptcha(owner, name, isCurrentProvider).then((res) => {
|
||||
if (res.type === "none") {
|
||||
|
Reference in New Issue
Block a user