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