feat: refresh inline captcha on login failure (#4108)

This commit is contained in:
Attack825
2025-08-21 10:29:56 +08:00
committed by GitHub
parent e533ff1ee1
commit f7bc822087
2 changed files with 18 additions and 1 deletions

View File

@@ -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") {