mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
fix: enable captcha in the application which is not built-in (#1061)
This commit is contained in:
parent
e2921419b9
commit
f02875e1b1
@ -89,6 +89,7 @@ export const ResetModal = (props) => {
|
||||
textBefore={i18next.t("code:Code You Received")}
|
||||
onChange={setCode}
|
||||
onButtonClickArgs={[dest, destType, Setting.getApplicationName(application)]}
|
||||
application={application}
|
||||
/>
|
||||
</Row>
|
||||
</Col>
|
||||
|
@ -353,11 +353,13 @@ class ForgetPage extends React.Component {
|
||||
<CountDownInput
|
||||
disabled={this.state.username === "" || this.state.verifyType === ""}
|
||||
onButtonClickArgs={[this.state.email, "email", Setting.getApplicationName(this.state.application), this.state.name]}
|
||||
application={application}
|
||||
/>
|
||||
) : (
|
||||
<CountDownInput
|
||||
disabled={this.state.username === "" || this.state.verifyType === ""}
|
||||
onButtonClickArgs={[this.state.phone, "phone", Setting.getApplicationName(this.state.application), this.state.name]}
|
||||
application={application}
|
||||
/>
|
||||
)}
|
||||
</Form.Item>
|
||||
|
@ -625,6 +625,7 @@ class LoginPage extends React.Component {
|
||||
<CountDownInput
|
||||
disabled={this.state.username?.length === 0 || !this.state.validEmailOrPhone}
|
||||
onButtonClickArgs={[this.state.username, this.state.validEmail ? "email" : "phone", Setting.getApplicationName(application)]}
|
||||
application={application}
|
||||
/>
|
||||
</Form.Item>
|
||||
) : (
|
||||
|
@ -360,6 +360,7 @@ class SignupPage extends React.Component {
|
||||
<CountDownInput
|
||||
disabled={!this.state.validEmail}
|
||||
onButtonClickArgs={[this.state.email, "email", Setting.getApplicationName(application)]}
|
||||
application={application}
|
||||
/>
|
||||
</Form.Item>
|
||||
}
|
||||
@ -412,6 +413,7 @@ class SignupPage extends React.Component {
|
||||
<CountDownInput
|
||||
disabled={!this.state.validPhone}
|
||||
onButtonClickArgs={[this.state.phone, "phone", Setting.getApplicationName(application)]}
|
||||
application={application}
|
||||
/>
|
||||
</Form.Item>
|
||||
</React.Fragment>
|
||||
|
@ -17,13 +17,12 @@ import React from "react";
|
||||
import i18next from "i18next";
|
||||
import * as UserBackend from "../backend/UserBackend";
|
||||
import {SafetyOutlined} from "@ant-design/icons";
|
||||
import {authConfig} from "../auth/Auth";
|
||||
import {CaptchaWidget} from "./CaptchaWidget";
|
||||
|
||||
const {Search} = Input;
|
||||
|
||||
export const CountDownInput = (props) => {
|
||||
const {disabled, textBefore, onChange, onButtonClickArgs} = props;
|
||||
const {disabled, textBefore, onChange, onButtonClickArgs, application} = props;
|
||||
const [visible, setVisible] = React.useState(false);
|
||||
const [key, setKey] = React.useState("");
|
||||
const [captchaImg, setCaptchaImg] = React.useState("");
|
||||
@ -69,7 +68,7 @@ export const CountDownInput = (props) => {
|
||||
};
|
||||
|
||||
const loadCaptcha = () => {
|
||||
UserBackend.getCaptcha("admin", authConfig.appName, false).then(res => {
|
||||
UserBackend.getCaptcha(application.owner, application.name, false).then(res => {
|
||||
if (res.type === "none") {
|
||||
UserBackend.sendCode("none", "", "", ...onButtonClickArgs).then(res => {
|
||||
if (res) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user