mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Add Organization to Application.
This commit is contained in:
@ -24,9 +24,10 @@ type Application struct {
|
||||
Name string `xorm:"varchar(100) notnull pk" json:"name"`
|
||||
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
|
||||
|
||||
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
||||
Logo string `xorm:"varchar(100)" json:"logo"`
|
||||
Providers []string `xorm:"varchar(100)" json:"providers"`
|
||||
DisplayName string `xorm:"varchar(100)" json:"displayName"`
|
||||
Logo string `xorm:"varchar(100)" json:"logo"`
|
||||
Organization string `xorm:"varchar(100)" json:"organization"`
|
||||
Providers []string `xorm:"varchar(100)" json:"providers"`
|
||||
}
|
||||
|
||||
func GetApplications(owner string) []*Application {
|
||||
|
@ -1,9 +1,10 @@
|
||||
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 * as ApplicationBackend from "./backend/ApplicationBackend";
|
||||
import * as Setting from "./Setting";
|
||||
import * as ProviderBackend from "./backend/ProviderBackend";
|
||||
import * as OrganizationBackend from "./backend/OrganizationBackend";
|
||||
import Face from "./Face";
|
||||
|
||||
const { Option } = Select;
|
||||
@ -15,12 +16,14 @@ class ApplicationEditPage extends React.Component {
|
||||
classes: props,
|
||||
applicationName: props.match.params.applicationName,
|
||||
application: null,
|
||||
organizations: [],
|
||||
providers: [],
|
||||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.getApplication();
|
||||
this.getOrganizations();
|
||||
this.getProviders();
|
||||
}
|
||||
|
||||
@ -33,6 +36,15 @@ class ApplicationEditPage extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
getOrganizations() {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: res,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getProviders() {
|
||||
ProviderBackend.getProviders("admin")
|
||||
.then((res) => {
|
||||
@ -114,6 +126,18 @@ class ApplicationEditPage extends React.Component {
|
||||
</Row>
|
||||
</Col>
|
||||
</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'}} >
|
||||
<Col style={{marginTop: '5px'}} span={2}>
|
||||
Providers:
|
||||
|
@ -2,6 +2,8 @@ import React from "react";
|
||||
import {Button, Checkbox, Col, Form, Input, Row} from "antd";
|
||||
import {LockOutlined, UserOutlined} from "@ant-design/icons";
|
||||
import * as ApplicationBackend from "./backend/ApplicationBackend";
|
||||
import * as AccountBackend from "./backend/AccountBackend";
|
||||
import * as Setting from "./Setting";
|
||||
|
||||
class Face extends React.Component {
|
||||
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() {
|
||||
return (
|
||||
<Form
|
||||
name="normal_login"
|
||||
initialValues={{ remember: true }}
|
||||
// onFinish={this.onFinish.bind(this)}
|
||||
onFinish={this.onFinish.bind(this)}
|
||||
style={{width: "250px"}}
|
||||
size="large"
|
||||
>
|
||||
|
Reference in New Issue
Block a user