mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-22 18:25:47 +08:00
Improve provider type input box
This commit is contained in:
parent
f879170663
commit
55c522d3b7
@ -380,7 +380,7 @@ class ProviderEditPage extends React.Component {
|
||||
{Setting.getLabel(i18next.t("provider:Type"), i18next.t("provider:Type - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Select virtual={false} style={{width: "100%"}} value={this.state.provider.type} onChange={(value => {
|
||||
<Select virtual={false} style={{width: "100%"}} showSearch value={this.state.provider.type} onChange={(value => {
|
||||
this.updateProviderField("type", value);
|
||||
if (value === "Local File System") {
|
||||
this.updateProviderField("domain", Setting.getFullServerUrl());
|
||||
@ -395,7 +395,10 @@ class ProviderEditPage extends React.Component {
|
||||
{
|
||||
Setting.getProviderTypeOptions(this.state.provider.category)
|
||||
.sort((a, b) => a.name.localeCompare(b.name))
|
||||
.map((providerType, index) => <Option key={index} value={providerType.id}>{providerType.name}</Option>)
|
||||
.map((providerType, index) => <Option key={index} value={providerType.id}>
|
||||
<img width={20} height={20} style={{marginBottom: "3px", marginRight: "10px"}} src={Setting.getProviderLogoURL({category: this.state.provider.category, type: providerType.id})} alt={providerType.id} />
|
||||
{providerType.name}
|
||||
</Option>)
|
||||
}
|
||||
</Select>
|
||||
</Col>
|
||||
@ -592,7 +595,7 @@ class ProviderEditPage extends React.Component {
|
||||
)
|
||||
}
|
||||
{
|
||||
this.state.provider.type !== "Adfs" && this.state.provider.type !== "AzureAD" && this.state.provider.type !== "Casdoor" && this.state.provider.type !== "Okta" ? null : (
|
||||
this.state.provider.type !== "ADFS" && this.state.provider.type !== "AzureAD" && this.state.provider.type !== "Casdoor" && this.state.provider.type !== "Okta" ? null : (
|
||||
<Row style={{marginTop: "20px"}} >
|
||||
<Col style={{marginTop: "5px"}} span={2}>
|
||||
{Setting.getLabel(i18next.t("provider:Domain"), i18next.t("provider:Domain - Tooltip"))} :
|
||||
|
@ -736,7 +736,7 @@ export function getClickable(text) {
|
||||
|
||||
export function getProviderLogoURL(provider) {
|
||||
if (provider.category === "OAuth") {
|
||||
if (provider.type === "Custom") {
|
||||
if (provider.type === "Custom" && provider.customLogo) {
|
||||
return provider.customLogo;
|
||||
}
|
||||
return `${StaticBaseUrl}/img/social_${provider.type.toLowerCase()}.png`;
|
||||
@ -775,7 +775,7 @@ export function getProviderTypeOptions(category) {
|
||||
{id: "WeCom", name: "WeCom"},
|
||||
{id: "Lark", name: "Lark"},
|
||||
{id: "GitLab", name: "GitLab"},
|
||||
{id: "Adfs", name: "Adfs"},
|
||||
{id: "ADFS", name: "ADFS"},
|
||||
{id: "Baidu", name: "Baidu"},
|
||||
{id: "Alipay", name: "Alipay"},
|
||||
{id: "Casdoor", name: "Casdoor"},
|
||||
|
@ -73,7 +73,7 @@ const authInfo = {
|
||||
scope: "read_user+profile",
|
||||
endpoint: "https://gitlab.com/oauth/authorize",
|
||||
},
|
||||
Adfs: {
|
||||
ADFS: {
|
||||
scope: "openid",
|
||||
endpoint: "http://example.com",
|
||||
},
|
||||
@ -433,7 +433,7 @@ export function getAuthUrl(application, provider, method) {
|
||||
}
|
||||
} else if (provider.type === "Lark") {
|
||||
return `${endpoint}?app_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}`;
|
||||
} else if (provider.type === "Adfs") {
|
||||
} else if (provider.type === "ADFS") {
|
||||
return `${provider.domain}/adfs/oauth2/authorize?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&nonce=casdoor&scope=openid`;
|
||||
} else if (provider.type === "Baidu") {
|
||||
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&display=popup`;
|
||||
|
@ -71,7 +71,7 @@ function getSigninButton(provider) {
|
||||
return <LarkLoginButton text={text} align={"center"} />;
|
||||
} else if (provider.type === "GitLab") {
|
||||
return <GitLabLoginButton text={text} align={"center"} />;
|
||||
} else if (provider.type === "Adfs") {
|
||||
} else if (provider.type === "ADFS") {
|
||||
return <AdfsLoginButton text={text} align={"center"} />;
|
||||
} else if (provider.type === "Casdoor") {
|
||||
return <CasdoorLoginButton text={text} align={"center"} />;
|
||||
|
Loading…
x
Reference in New Issue
Block a user