mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Fix the signup.
This commit is contained in:
@ -24,6 +24,7 @@ import * as Setting from "../Setting";
|
||||
import {GithubLoginButton, GoogleLoginButton} from "react-social-login-buttons";
|
||||
import QqLoginButton from "./QqLoginButton";
|
||||
import i18next from "i18next";
|
||||
import {authConfig} from "./Auth";
|
||||
|
||||
class LoginPage extends React.Component {
|
||||
constructor(props) {
|
||||
@ -139,6 +140,14 @@ class LoginPage extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
getSignupPath(application) {
|
||||
if (authConfig.appName === application.name) {
|
||||
return "/signup";
|
||||
} else {
|
||||
return `/signup/${application.name}`;
|
||||
}
|
||||
}
|
||||
|
||||
renderForm(application) {
|
||||
if (this.state.msg !== null) {
|
||||
return Util.renderMessage(this.state.msg)
|
||||
@ -156,15 +165,16 @@ class LoginPage extends React.Component {
|
||||
style={{width: "250px"}}
|
||||
size="large"
|
||||
>
|
||||
<Form.Item style={{height: 0, visibility: "hidden"}}
|
||||
name="organization"
|
||||
rules={[{ required: true, message: 'Please input your organization!' }]}
|
||||
<Form.Item
|
||||
style={{height: 0, visibility: "hidden"}}
|
||||
name="organization"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: 'Please input your organization!',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input
|
||||
prefix={<UserOutlined className="site-form-item-icon" />}
|
||||
placeholder="organization"
|
||||
disabled={!application.enablePassword}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="username"
|
||||
@ -210,7 +220,7 @@ class LoginPage extends React.Component {
|
||||
!application.enableSignUp ? null : (
|
||||
<div style={{float: "right"}}>
|
||||
{i18next.t("login:No account yet?")}
|
||||
<Link to={"/signup"}>
|
||||
<Link to={this.getSignupPath(application)}>
|
||||
{i18next.t("login:sign up now")}
|
||||
</Link>
|
||||
</div>
|
||||
@ -250,7 +260,7 @@ class LoginPage extends React.Component {
|
||||
<br/>
|
||||
<div style={{float: "right"}}>
|
||||
No account yet?
|
||||
<Link to={"/signup"}>
|
||||
<Link to={this.getSignupPath(application)}>
|
||||
sign up now
|
||||
</Link>
|
||||
</div>
|
||||
|
@ -15,6 +15,7 @@
|
||||
import React from "react";
|
||||
import {Link} from "react-router-dom";
|
||||
import {Result, Button} from 'antd';
|
||||
import i18next from "i18next";
|
||||
|
||||
class ResultPage extends React.Component {
|
||||
constructor(props) {
|
||||
@ -29,12 +30,12 @@ class ResultPage extends React.Component {
|
||||
<div>
|
||||
<Result
|
||||
status="success"
|
||||
title="Your account is created"
|
||||
subTitle="Please click the below button to login"
|
||||
title={i18next.t("signup:Your account has been created!")}
|
||||
subTitle={i18next.t("signup:Please click the below button to sign in")}
|
||||
extra={[
|
||||
<Link to="/login">
|
||||
<Button type="primary" key="login">
|
||||
Login
|
||||
{i18next.t("login:Sign In")}
|
||||
</Button>
|
||||
</Link>
|
||||
]}
|
||||
|
@ -106,7 +106,7 @@ class SignupPage extends React.Component {
|
||||
|
||||
renderForm(application) {
|
||||
const prefixSelector = (
|
||||
<Form.Item name="prefix" noStyle>
|
||||
<Form.Item name="phonePrefix" noStyle>
|
||||
<Select
|
||||
style={{
|
||||
width: 80,
|
||||
@ -126,12 +126,23 @@ class SignupPage extends React.Component {
|
||||
onFinish={(values) => this.onFinish(values)}
|
||||
onFinishFailed={(errorInfo) => this.onFinishFailed(errorInfo.values, errorInfo.errorFields, errorInfo.outOfDate)}
|
||||
initialValues={{
|
||||
application: application.name,
|
||||
prefix: '86',
|
||||
organization: application.organization,
|
||||
phonePrefix: '86',
|
||||
}}
|
||||
style={{width: !Setting.isMobile() ? "400px" : "250px"}}
|
||||
size="large"
|
||||
>
|
||||
<Form.Item
|
||||
style={{height: 0, visibility: "hidden"}}
|
||||
name="organization"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: 'Please input your organization!',
|
||||
},
|
||||
]}
|
||||
>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="username"
|
||||
label={i18next.t("signup:Username")}
|
||||
@ -146,7 +157,7 @@ class SignupPage extends React.Component {
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="displayName"
|
||||
name="name"
|
||||
label={i18next.t("general:Display name")}
|
||||
rules={[
|
||||
{
|
||||
|
@ -44,7 +44,9 @@
|
||||
"Accept": "Accept",
|
||||
"Terms of Use": "Terms of Use",
|
||||
"Have account?": "Have account?",
|
||||
"sign in now": "sign in now"
|
||||
"sign in now": "sign in now",
|
||||
"Your account has been created!": "Your account has been created!",
|
||||
"Please click the below button to sign in": "Please click the below button to sign in"
|
||||
},
|
||||
"login":
|
||||
{
|
||||
|
@ -44,7 +44,9 @@
|
||||
"Accept": "阅读并接受",
|
||||
"Terms of Use": "《用户协议》",
|
||||
"Have account?": "已有账号?",
|
||||
"sign in now": "立即登录"
|
||||
"sign in now": "立即登录",
|
||||
"Your account has been created!": "您的账号已创建!",
|
||||
"Please click the below button to sign in": "请点击下方按钮登录"
|
||||
},
|
||||
"login":
|
||||
{
|
||||
|
Reference in New Issue
Block a user