mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Add Organization to Application.
This commit is contained in:
@ -26,6 +26,7 @@ type Application struct {
|
|||||||
|
|
||||||
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
||||||
Logo string `xorm:"varchar(100)" json:"logo"`
|
Logo string `xorm:"varchar(100)" json:"logo"`
|
||||||
|
Organization string `xorm:"varchar(100)" json:"organization"`
|
||||||
Providers []string `xorm:"varchar(100)" json:"providers"`
|
Providers []string `xorm:"varchar(100)" json:"providers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import {AutoComplete, Button, Card, Col, Input, Row, Select} from 'antd';
|
import {Button, Card, Col, Input, Row, Select} from 'antd';
|
||||||
import {LinkOutlined} from "@ant-design/icons";
|
import {LinkOutlined} from "@ant-design/icons";
|
||||||
import * as ApplicationBackend from "./backend/ApplicationBackend";
|
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 Face from "./Face";
|
import Face from "./Face";
|
||||||
|
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
@ -15,12 +16,14 @@ class ApplicationEditPage extends React.Component {
|
|||||||
classes: props,
|
classes: props,
|
||||||
applicationName: props.match.params.applicationName,
|
applicationName: props.match.params.applicationName,
|
||||||
application: null,
|
application: null,
|
||||||
|
organizations: [],
|
||||||
providers: [],
|
providers: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
this.getApplication();
|
this.getApplication();
|
||||||
|
this.getOrganizations();
|
||||||
this.getProviders();
|
this.getProviders();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +36,15 @@ class ApplicationEditPage extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getOrganizations() {
|
||||||
|
OrganizationBackend.getOrganizations("admin")
|
||||||
|
.then((res) => {
|
||||||
|
this.setState({
|
||||||
|
organizations: res,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getProviders() {
|
getProviders() {
|
||||||
ProviderBackend.getProviders("admin")
|
ProviderBackend.getProviders("admin")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -114,6 +126,18 @@ class ApplicationEditPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
|
Organization:
|
||||||
|
</Col>
|
||||||
|
<Col span={22} >
|
||||||
|
<Select virtual={false} style={{width: '100%'}} value={this.state.application.organization} onChange={(value => {this.updateApplicationField('organization', value);})}>
|
||||||
|
{
|
||||||
|
this.state.organizations.map((organization, index) => <Option key={index} value={organization.name}>{organization.name}</Option>)
|
||||||
|
}
|
||||||
|
</Select>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={2}>
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
Providers:
|
Providers:
|
||||||
|
@ -2,6 +2,8 @@ import React from "react";
|
|||||||
import {Button, Checkbox, Col, Form, Input, Row} from "antd";
|
import {Button, Checkbox, Col, Form, Input, Row} from "antd";
|
||||||
import {LockOutlined, UserOutlined} from "@ant-design/icons";
|
import {LockOutlined, UserOutlined} from "@ant-design/icons";
|
||||||
import * as ApplicationBackend from "./backend/ApplicationBackend";
|
import * as ApplicationBackend from "./backend/ApplicationBackend";
|
||||||
|
import * as AccountBackend from "./backend/AccountBackend";
|
||||||
|
import * as Setting from "./Setting";
|
||||||
|
|
||||||
class Face extends React.Component {
|
class Face extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -34,12 +36,25 @@ class Face extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onFinish(values) {
|
||||||
|
AccountBackend.login(values)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.status === 'ok') {
|
||||||
|
this.props.onLogined();
|
||||||
|
Setting.showMessage("success", `Logged in successfully`);
|
||||||
|
Setting.goToLink("/");
|
||||||
|
} else {
|
||||||
|
Setting.showMessage("error", `Log in failed:${res.msg}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
renderForm() {
|
renderForm() {
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
name="normal_login"
|
name="normal_login"
|
||||||
initialValues={{ remember: true }}
|
initialValues={{ remember: true }}
|
||||||
// onFinish={this.onFinish.bind(this)}
|
onFinish={this.onFinish.bind(this)}
|
||||||
style={{width: "250px"}}
|
style={{width: "250px"}}
|
||||||
size="large"
|
size="large"
|
||||||
>
|
>
|
||||||
|
Reference in New Issue
Block a user