mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Only show some providers in signup page.
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
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 * as ProviderBackend from "./backend/ProviderBackend";
|
||||
import * as Setting from "./Setting";
|
||||
@ -177,6 +177,16 @@ class ProviderEditPage extends React.Component {
|
||||
}} />
|
||||
</Col>
|
||||
</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" ? (
|
||||
<React.Fragment>
|
||||
|
@ -53,6 +53,7 @@ class ProviderListPage extends React.Component {
|
||||
type: "GitHub",
|
||||
clientId: "",
|
||||
clientSecret: "",
|
||||
enableSignUp: true,
|
||||
host: "",
|
||||
port: 0,
|
||||
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) {
|
||||
if (s === "") {
|
||||
return null;
|
||||
|
@ -154,7 +154,7 @@ class UserEditPage extends React.Component {
|
||||
|
||||
return (
|
||||
<Row key={provider.name} style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={2}>
|
||||
<Col style={{marginTop: '5px'}} span={3}>
|
||||
{
|
||||
Setting.getProviderLogo(provider)
|
||||
}
|
||||
@ -164,7 +164,7 @@ class UserEditPage extends React.Component {
|
||||
}
|
||||
</span>
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Col span={21} >
|
||||
<img style={{marginRight: '10px'}} width={30} height={30} src={avatarUrl} alt={name} />
|
||||
<span style={{width: '300px', display: "inline-block"}}>
|
||||
{
|
||||
|
@ -13,7 +13,6 @@
|
||||
// limitations under the License.
|
||||
|
||||
import React from "react";
|
||||
import {Link} from "react-router-dom";
|
||||
import {Button, Checkbox, Col, Form, Input, Row} from "antd";
|
||||
import {LockOutlined, UserOutlined} from "@ant-design/icons";
|
||||
import * as AuthBackend from "./AuthBackend";
|
||||
@ -224,7 +223,7 @@ class LoginPage extends React.Component {
|
||||
</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");
|
||||
})
|
||||
}
|
||||
@ -245,7 +244,7 @@ class LoginPage extends React.Component {
|
||||
</div>
|
||||
<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");
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user