mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-15 12:13:50 +08:00
Show signup preview.
This commit is contained in:
@ -19,6 +19,7 @@ import * as ApplicationBackend from "./backend/ApplicationBackend";
|
|||||||
import * as Setting from "./Setting";
|
import * as Setting from "./Setting";
|
||||||
import * as ProviderBackend from "./backend/ProviderBackend";
|
import * as ProviderBackend from "./backend/ProviderBackend";
|
||||||
import * as OrganizationBackend from "./backend/OrganizationBackend";
|
import * as OrganizationBackend from "./backend/OrganizationBackend";
|
||||||
|
import SignupPage from "./auth/SignupPage";
|
||||||
import LoginPage from "./auth/LoginPage";
|
import LoginPage from "./auth/LoginPage";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import UrlTable from "./UrlTable";
|
import UrlTable from "./UrlTable";
|
||||||
@ -208,10 +209,10 @@ class ApplicationEditPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={2}>
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
{i18next.t("general:Expire in hours")}:
|
{i18next.t("general:Token expire")}:
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<Input value={this.state.application.expireInHours} onChange={e => {
|
<Input style={{width: "150px"}} value={this.state.application.expireInHours} suffix="Hours" onChange={e => {
|
||||||
this.updateApplicationField('expireInHours', e.target.value);
|
this.updateApplicationField('expireInHours', e.target.value);
|
||||||
}} />
|
}} />
|
||||||
</Col>
|
</Col>
|
||||||
@ -284,17 +285,25 @@ class ApplicationEditPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={2}>
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
{i18next.t("application:Login page preview")}:
|
{i18next.t("general:Preview")}:
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={11} >
|
||||||
<a style={{marginBottom: '10px'}} target="_blank" rel="noreferrer" href={`/login/oauth/authorize?client_id=${this.state.application.clientId}&response_type=code&redirect_uri=${this.state.application.redirectUris[0]}&scope=read&state=casdoor`}>
|
<a style={{marginBottom: '10px'}} target="_blank" rel="noreferrer" href={`/signup/${this.state.application.name}`}>
|
||||||
{
|
<Button type="primary">{i18next.t("application:Test signup page..")}</Button>
|
||||||
`${window.location.host}/login/oauth/authorize?client_id=${this.state.application.clientId}&response_type=code&redirect_uri=${this.state.application.redirectUris[0]}&scope=read&state=casdoor`
|
|
||||||
}
|
|
||||||
</a>
|
</a>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<div style={{width: "500px", height: "600px", border: "1px solid rgb(217,217,217)"}}>
|
<div style={{width: "90%", border: "1px solid rgb(217,217,217)", boxShadow: "10px 10px 5px #888888"}}>
|
||||||
|
<SignupPage application={this.state.application} />
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col span={11} >
|
||||||
|
<a style={{marginBottom: '10px'}} target="_blank" rel="noreferrer" href={`/login/oauth/authorize?client_id=${this.state.application.clientId}&response_type=code&redirect_uri=${this.state.application.redirectUris[0]}&scope=read&state=casdoor`}>
|
||||||
|
<Button type="primary">{i18next.t("application:Test signin page..")}</Button>
|
||||||
|
</a>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<div style={{width: "90%", border: "1px solid rgb(217,217,217)", boxShadow: "10px 10px 5px #888888"}}>
|
||||||
<LoginPage type={"login"} application={this.state.application} />
|
<LoginPage type={"login"} application={this.state.application} />
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
|
@ -95,7 +95,7 @@ class UrlTable extends React.Component {
|
|||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table rowKey="index" columns={columns} dataSource={table.map((row, i) => ({id: row, index: i}))} size="middle" bordered pagination={{pageSize: 100}}
|
<Table rowKey="index" columns={columns} dataSource={table.map((row, i) => ({id: row, index: i}))} size="middle" bordered pagination={false}
|
||||||
title={() => (
|
title={() => (
|
||||||
<div>
|
<div>
|
||||||
{this.props.title}
|
{this.props.title}
|
||||||
|
@ -61,7 +61,7 @@ class SignupPage extends React.Component {
|
|||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
classes: props,
|
classes: props,
|
||||||
applicationName: props.match.params.applicationName !== undefined ? props.match.params.applicationName : authConfig.appName,
|
applicationName: props.match?.params.applicationName !== undefined ? props.match.params.applicationName : authConfig.appName,
|
||||||
application: null,
|
application: null,
|
||||||
email: "",
|
email: "",
|
||||||
phone: "",
|
phone: "",
|
||||||
@ -101,12 +101,21 @@ class SignupPage extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getApplicationObj() {
|
||||||
|
if (this.props.application !== undefined) {
|
||||||
|
return this.props.application;
|
||||||
|
} else {
|
||||||
|
return this.state.application;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onFinish(values) {
|
onFinish(values) {
|
||||||
values.phonePrefix = this.state.application?.organizationObj.phonePrefix;
|
const application = this.getApplicationObj();
|
||||||
|
values.phonePrefix = application.organizationObj.phonePrefix;
|
||||||
AuthBackend.signup(values)
|
AuthBackend.signup(values)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === 'ok') {
|
if (res.status === 'ok') {
|
||||||
Setting.goToLinkSoft(this, this.getResultPath(this.state.application));
|
Setting.goToLinkSoft(this, this.getResultPath(application));
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", i18next.t(`signup:${res.msg}`));
|
Setting.showMessage("error", i18next.t(`signup:${res.msg}`));
|
||||||
}
|
}
|
||||||
@ -240,7 +249,7 @@ class SignupPage extends React.Component {
|
|||||||
<CountDownInput
|
<CountDownInput
|
||||||
defaultButtonText={i18next.t("signup:send code")}
|
defaultButtonText={i18next.t("signup:send code")}
|
||||||
onButtonClick={UserBackend.sendCode}
|
onButtonClick={UserBackend.sendCode}
|
||||||
onButtonClickArgs={[this.state.email, "email", this.state.application?.organizationObj.owner + "/" + this.state.application?.organizationObj.name]}
|
onButtonClickArgs={[this.state.email, "email", application?.organizationObj.owner + "/" + application?.organizationObj.name]}
|
||||||
coolDownTime={60}
|
coolDownTime={60}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@ -311,7 +320,7 @@ class SignupPage extends React.Component {
|
|||||||
<CountDownInput
|
<CountDownInput
|
||||||
defaultButtonText={i18next.t("signup:send code")}
|
defaultButtonText={i18next.t("signup:send code")}
|
||||||
onButtonClick={UserBackend.sendCode}
|
onButtonClick={UserBackend.sendCode}
|
||||||
onButtonClickArgs={[this.state.phone, "phone", this.state.application?.organizationObj.owner + "/" + this.state.application?.organizationObj.name]}
|
onButtonClickArgs={[this.state.phone, "phone", application.organizationObj.owner + "/" + application.organizationObj.name]}
|
||||||
coolDownTime={60}
|
coolDownTime={60}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@ -339,7 +348,7 @@ class SignupPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const application = this.state.application;
|
const application = this.getApplicationObj();
|
||||||
if (application === null) {
|
if (application === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,9 @@
|
|||||||
{
|
{
|
||||||
"Edit Application": "Edit Application",
|
"Edit Application": "Edit Application",
|
||||||
"Enable password": "Enable password",
|
"Enable password": "Enable password",
|
||||||
"Login page preview": "Login page preview"
|
"Login page preview": "Login page preview",
|
||||||
|
"Test signup page..": "Test signup page..",
|
||||||
|
"Test signin page..": "Test signin page.."
|
||||||
},
|
},
|
||||||
"forget":
|
"forget":
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,9 @@
|
|||||||
{
|
{
|
||||||
"Edit Application": "修改应用",
|
"Edit Application": "修改应用",
|
||||||
"Enable password": "开启密码",
|
"Enable password": "开启密码",
|
||||||
"Login page preview": "登录页面预览"
|
"Login page preview": "登录页面预览",
|
||||||
|
"Test signup page..": "测试注册页面..",
|
||||||
|
"Test signin page..": "测试登录页面.."
|
||||||
},
|
},
|
||||||
"forget":
|
"forget":
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user