mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 20:50:19 +08:00
Only show some providers in signup page.
This commit is contained in:
@ -29,6 +29,7 @@ type Provider struct {
|
|||||||
Type string `xorm:"varchar(100)" json:"type"`
|
Type string `xorm:"varchar(100)" json:"type"`
|
||||||
ClientId string `xorm:"varchar(100)" json:"clientId"`
|
ClientId string `xorm:"varchar(100)" json:"clientId"`
|
||||||
ClientSecret string `xorm:"varchar(100)" json:"clientSecret"`
|
ClientSecret string `xorm:"varchar(100)" json:"clientSecret"`
|
||||||
|
EnableSignUp bool `json:"enableSignUp"`
|
||||||
|
|
||||||
Host string `xorm:"varchar(100)" json:"host"`
|
Host string `xorm:"varchar(100)" json:"host"`
|
||||||
Port int `json:"port"`
|
Port int `json:"port"`
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {Button, Card, Col, Input, InputNumber, Row, Select} from 'antd';
|
import {Button, Card, Col, Input, InputNumber, Row, Select, Switch} from 'antd';
|
||||||
import {LinkOutlined} from "@ant-design/icons";
|
import {LinkOutlined} from "@ant-design/icons";
|
||||||
import * as ProviderBackend from "./backend/ProviderBackend";
|
import * as ProviderBackend from "./backend/ProviderBackend";
|
||||||
import * as Setting from "./Setting";
|
import * as Setting from "./Setting";
|
||||||
@ -177,6 +177,16 @@ class ProviderEditPage extends React.Component {
|
|||||||
}} />
|
}} />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
|
{i18next.t("application:Enable signup")}:
|
||||||
|
</Col>
|
||||||
|
<Col span={1} >
|
||||||
|
<Switch checked={this.state.provider.enableSignUp} onChange={checked => {
|
||||||
|
this.updateProviderField('enableSignUp', checked);
|
||||||
|
}} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
{
|
{
|
||||||
this.state.provider.category === "Email" ? (
|
this.state.provider.category === "Email" ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
@ -53,6 +53,7 @@ class ProviderListPage extends React.Component {
|
|||||||
type: "GitHub",
|
type: "GitHub",
|
||||||
clientId: "",
|
clientId: "",
|
||||||
clientSecret: "",
|
clientSecret: "",
|
||||||
|
enableSignUp: true,
|
||||||
host: "",
|
host: "",
|
||||||
port: 0,
|
port: 0,
|
||||||
providerUrl: "https://github.com/organizations/xxx/settings/applications/1234567",
|
providerUrl: "https://github.com/organizations/xxx/settings/applications/1234567",
|
||||||
|
@ -47,6 +47,14 @@ export function isProviderVisible(provider) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isProviderVisibleForSignUp(provider) {
|
||||||
|
if (provider.enableSignUp === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isProviderVisible(provider);
|
||||||
|
}
|
||||||
|
|
||||||
export function parseJson(s) {
|
export function parseJson(s) {
|
||||||
if (s === "") {
|
if (s === "") {
|
||||||
return null;
|
return null;
|
||||||
|
@ -154,7 +154,7 @@ class UserEditPage extends React.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Row key={provider.name} style={{marginTop: '20px'}} >
|
<Row key={provider.name} style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={2}>
|
<Col style={{marginTop: '5px'}} span={3}>
|
||||||
{
|
{
|
||||||
Setting.getProviderLogo(provider)
|
Setting.getProviderLogo(provider)
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ class UserEditPage extends React.Component {
|
|||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={21} >
|
||||||
<img style={{marginRight: '10px'}} width={30} height={30} src={avatarUrl} alt={name} />
|
<img style={{marginRight: '10px'}} width={30} height={30} src={avatarUrl} alt={name} />
|
||||||
<span style={{width: '300px', display: "inline-block"}}>
|
<span style={{width: '300px', display: "inline-block"}}>
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {Link} from "react-router-dom";
|
|
||||||
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 AuthBackend from "./AuthBackend";
|
import * as AuthBackend from "./AuthBackend";
|
||||||
@ -224,7 +223,7 @@ class LoginPage extends React.Component {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
{
|
{
|
||||||
application.providerObjs.filter(provider => Setting.isProviderVisible(provider)).map(provider => {
|
application.providerObjs.filter(provider => Setting.isProviderVisibleForSignUp(provider)).map(provider => {
|
||||||
return this.renderProviderLogo(provider, application, 30, 5, "small");
|
return this.renderProviderLogo(provider, application, 30, 5, "small");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -245,7 +244,7 @@ class LoginPage extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
{
|
{
|
||||||
application.providerObjs.filter(provider => Setting.isProviderVisible(provider)).map(provider => {
|
application.providerObjs.filter(provider => Setting.isProviderVisibleForSignUp(provider)).map(provider => {
|
||||||
return this.renderProviderLogo(provider, application, 40, 10, "big");
|
return this.renderProviderLogo(provider, application, 40, 10, "big");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user