mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Filter github providers.
This commit is contained in:
parent
fce4efcb84
commit
9346587ca6
@ -124,7 +124,7 @@ class ApplicationListPage extends React.Component {
|
||||
title: 'Logo',
|
||||
dataIndex: 'logo',
|
||||
key: 'logo',
|
||||
width: '250px',
|
||||
width: '200px',
|
||||
render: (text, record, index) => {
|
||||
return (
|
||||
<a target="_blank" rel="noreferrer" href={text}>
|
||||
@ -151,7 +151,7 @@ class ApplicationListPage extends React.Component {
|
||||
title: i18next.t("general:Providers"),
|
||||
dataIndex: 'providers',
|
||||
key: 'providers',
|
||||
width: '250px',
|
||||
width: '300px',
|
||||
render: (text, record, index) => {
|
||||
const providers = text;
|
||||
if (providers.length === 0) {
|
||||
|
@ -30,6 +30,23 @@ export function initServerUrl() {
|
||||
}
|
||||
}
|
||||
|
||||
function isLocalhost() {
|
||||
const hostname = window.location.hostname;
|
||||
return hostname === "localhost";
|
||||
}
|
||||
|
||||
export function isProviderVisible(provider) {
|
||||
if (provider.type !== "GitHub") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isLocalhost()) {
|
||||
return provider.name.includes("localhost");
|
||||
} else {
|
||||
return !provider.name.includes("localhost");
|
||||
}
|
||||
}
|
||||
|
||||
export function parseJson(s) {
|
||||
if (s === "") {
|
||||
return null;
|
||||
|
@ -316,7 +316,7 @@ class UserEditPage extends React.Component {
|
||||
<Col span={22} >
|
||||
<div style={{marginBottom: 20}}>
|
||||
{
|
||||
this.state.providers.map((provider, index) => this.renderIdp(provider))
|
||||
this.state.providers.filter(provider => Setting.isProviderVisible(provider)).map((provider, index) => this.renderIdp(provider))
|
||||
}
|
||||
</div>
|
||||
</Col>
|
||||
|
@ -224,7 +224,7 @@ class LoginPage extends React.Component {
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
{
|
||||
application.providerObjs.map(provider => {
|
||||
application.providerObjs.filter(provider => Setting.isProviderVisible(provider)).map(provider => {
|
||||
return this.renderProviderLogo(provider, application, 30, 5, "small");
|
||||
})
|
||||
}
|
||||
@ -245,7 +245,7 @@ class LoginPage extends React.Component {
|
||||
</div>
|
||||
<br/>
|
||||
{
|
||||
application.providerObjs.map(provider => {
|
||||
application.providerObjs.filter(provider => Setting.isProviderVisible(provider)).map(provider => {
|
||||
return this.renderProviderLogo(provider, application, 40, 10, "big");
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user