mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Add willLog() and control access to signup page.
This commit is contained in:
@ -219,20 +219,20 @@ class App extends Component {
|
||||
if (this.state.account === undefined) {
|
||||
return null;
|
||||
} else if (this.state.account === null) {
|
||||
res.push(
|
||||
<Menu.Item key="100" style={{float: 'right', marginRight: '20px'}}>
|
||||
<Link to="/signup">
|
||||
{i18next.t("account:Sign Up")}
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
res.push(
|
||||
<Menu.Item key="101" style={{float: 'right'}}>
|
||||
<Link to="/login">
|
||||
{i18next.t("account:Login")}
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
);
|
||||
// res.push(
|
||||
// <Menu.Item key="100" style={{float: 'right', marginRight: '20px'}}>
|
||||
// <Link to="/signup">
|
||||
// {i18next.t("account:Sign Up")}
|
||||
// </Link>
|
||||
// </Menu.Item>
|
||||
// );
|
||||
// res.push(
|
||||
// <Menu.Item key="101" style={{float: 'right'}}>
|
||||
// <Link to="/login">
|
||||
// {i18next.t("account:Login")}
|
||||
// </Link>
|
||||
// </Menu.Item>
|
||||
// );
|
||||
} else {
|
||||
res.push(this.renderRightDropdown());
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import {Link} from "react-router-dom";
|
||||
import {Form, Input, Select, Checkbox, Button, Row, Col} from 'antd';
|
||||
import {Form, Input, Select, Checkbox, Button, Row, Col, Result} from 'antd';
|
||||
import * as Setting from "../Setting";
|
||||
import * as AuthBackend from "./AuthBackend";
|
||||
import i18next from "i18next";
|
||||
@ -113,6 +113,26 @@ class SignupPage extends React.Component {
|
||||
}
|
||||
|
||||
renderForm(application) {
|
||||
if (!application.enableSignUp) {
|
||||
return (
|
||||
<Result
|
||||
status="error"
|
||||
title="Sign Up Error"
|
||||
subTitle={"The application does not allow to sign up new account"}
|
||||
extra={[
|
||||
<Link onClick={() => {
|
||||
Setting.goToLogin(this, application);
|
||||
}}>
|
||||
<Button type="primary" key="signin">
|
||||
Sign In
|
||||
</Button>
|
||||
</Link>
|
||||
]}
|
||||
>
|
||||
</Result>
|
||||
)
|
||||
}
|
||||
|
||||
const prefixSelector = (
|
||||
<Form.Item name="phonePrefix" noStyle>
|
||||
<Select
|
||||
@ -134,12 +154,24 @@ class SignupPage extends React.Component {
|
||||
onFinish={(values) => this.onFinish(values)}
|
||||
onFinishFailed={(errorInfo) => this.onFinishFailed(errorInfo.values, errorInfo.errorFields, errorInfo.outOfDate)}
|
||||
initialValues={{
|
||||
application: application.name,
|
||||
organization: application.organization,
|
||||
phonePrefix: '86',
|
||||
}}
|
||||
style={{width: !Setting.isMobile() ? "400px" : "250px"}}
|
||||
size="large"
|
||||
>
|
||||
<Form.Item
|
||||
style={{height: 0, visibility: "hidden"}}
|
||||
name="application"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: 'Please input your application!',
|
||||
},
|
||||
]}
|
||||
>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
style={{height: 0, visibility: "hidden"}}
|
||||
name="organization"
|
||||
@ -221,7 +253,7 @@ class SignupPage extends React.Component {
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="confirm"
|
||||
label={i18next.t("signup:Confirm password")}
|
||||
label={i18next.t("signup:Confirm")}
|
||||
dependencies={['password']}
|
||||
hasFeedback
|
||||
rules={[
|
||||
|
@ -38,7 +38,7 @@
|
||||
"Please input your affiliation!": "Please input your affiliation!",
|
||||
"The input is not valid Email!": "The input is not valid Email!",
|
||||
"Please input your Email!": "Please input your Email!",
|
||||
"Confirm password": "Confirm password",
|
||||
"Confirm": "Confirm",
|
||||
"Please confirm your password!": "Please confirm your password!",
|
||||
"Your confirmed password is inconsistent with the password!": "Your confirmed password is inconsistent with the password!",
|
||||
"Please input your phone number!": "Please input your phone number!",
|
||||
|
@ -38,7 +38,7 @@
|
||||
"Please input your affiliation!": "请输入您所在的工作单位!",
|
||||
"The input is not valid Email!": "您输入的电子邮箱格式错误!",
|
||||
"Please input your Email!": "请输入您的电子邮箱!",
|
||||
"Confirm password": "确认密码",
|
||||
"Confirm": "确认密码",
|
||||
"Please confirm your password!": "请再次确认您的密码!",
|
||||
"Your confirmed password is inconsistent with the password!": "您两次输入的密码不一致!",
|
||||
"Please input your phone number!": "请输入您的手机号码!",
|
||||
|
Reference in New Issue
Block a user