mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-18 04:33:49 +08:00
Improve provider type input box
This commit is contained in:
@ -380,7 +380,7 @@ class ProviderEditPage extends React.Component {
|
|||||||
{Setting.getLabel(i18next.t("provider:Type"), i18next.t("provider:Type - Tooltip"))} :
|
{Setting.getLabel(i18next.t("provider:Type"), i18next.t("provider:Type - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<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);
|
this.updateProviderField("type", value);
|
||||||
if (value === "Local File System") {
|
if (value === "Local File System") {
|
||||||
this.updateProviderField("domain", Setting.getFullServerUrl());
|
this.updateProviderField("domain", Setting.getFullServerUrl());
|
||||||
@ -395,7 +395,10 @@ class ProviderEditPage extends React.Component {
|
|||||||
{
|
{
|
||||||
Setting.getProviderTypeOptions(this.state.provider.category)
|
Setting.getProviderTypeOptions(this.state.provider.category)
|
||||||
.sort((a, b) => a.name.localeCompare(b.name))
|
.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>
|
</Select>
|
||||||
</Col>
|
</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"}} >
|
<Row style={{marginTop: "20px"}} >
|
||||||
<Col style={{marginTop: "5px"}} span={2}>
|
<Col style={{marginTop: "5px"}} span={2}>
|
||||||
{Setting.getLabel(i18next.t("provider:Domain"), i18next.t("provider:Domain - Tooltip"))} :
|
{Setting.getLabel(i18next.t("provider:Domain"), i18next.t("provider:Domain - Tooltip"))} :
|
||||||
|
@ -736,7 +736,7 @@ export function getClickable(text) {
|
|||||||
|
|
||||||
export function getProviderLogoURL(provider) {
|
export function getProviderLogoURL(provider) {
|
||||||
if (provider.category === "OAuth") {
|
if (provider.category === "OAuth") {
|
||||||
if (provider.type === "Custom") {
|
if (provider.type === "Custom" && provider.customLogo) {
|
||||||
return provider.customLogo;
|
return provider.customLogo;
|
||||||
}
|
}
|
||||||
return `${StaticBaseUrl}/img/social_${provider.type.toLowerCase()}.png`;
|
return `${StaticBaseUrl}/img/social_${provider.type.toLowerCase()}.png`;
|
||||||
@ -775,7 +775,7 @@ export function getProviderTypeOptions(category) {
|
|||||||
{id: "WeCom", name: "WeCom"},
|
{id: "WeCom", name: "WeCom"},
|
||||||
{id: "Lark", name: "Lark"},
|
{id: "Lark", name: "Lark"},
|
||||||
{id: "GitLab", name: "GitLab"},
|
{id: "GitLab", name: "GitLab"},
|
||||||
{id: "Adfs", name: "Adfs"},
|
{id: "ADFS", name: "ADFS"},
|
||||||
{id: "Baidu", name: "Baidu"},
|
{id: "Baidu", name: "Baidu"},
|
||||||
{id: "Alipay", name: "Alipay"},
|
{id: "Alipay", name: "Alipay"},
|
||||||
{id: "Casdoor", name: "Casdoor"},
|
{id: "Casdoor", name: "Casdoor"},
|
||||||
|
@ -73,7 +73,7 @@ const authInfo = {
|
|||||||
scope: "read_user+profile",
|
scope: "read_user+profile",
|
||||||
endpoint: "https://gitlab.com/oauth/authorize",
|
endpoint: "https://gitlab.com/oauth/authorize",
|
||||||
},
|
},
|
||||||
Adfs: {
|
ADFS: {
|
||||||
scope: "openid",
|
scope: "openid",
|
||||||
endpoint: "http://example.com",
|
endpoint: "http://example.com",
|
||||||
},
|
},
|
||||||
@ -433,7 +433,7 @@ export function getAuthUrl(application, provider, method) {
|
|||||||
}
|
}
|
||||||
} else if (provider.type === "Lark") {
|
} else if (provider.type === "Lark") {
|
||||||
return `${endpoint}?app_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}`;
|
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`;
|
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") {
|
} else if (provider.type === "Baidu") {
|
||||||
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&display=popup`;
|
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"} />;
|
return <LarkLoginButton text={text} align={"center"} />;
|
||||||
} else if (provider.type === "GitLab") {
|
} else if (provider.type === "GitLab") {
|
||||||
return <GitLabLoginButton text={text} align={"center"} />;
|
return <GitLabLoginButton text={text} align={"center"} />;
|
||||||
} else if (provider.type === "Adfs") {
|
} else if (provider.type === "ADFS") {
|
||||||
return <AdfsLoginButton text={text} align={"center"} />;
|
return <AdfsLoginButton text={text} align={"center"} />;
|
||||||
} else if (provider.type === "Casdoor") {
|
} else if (provider.type === "Casdoor") {
|
||||||
return <CasdoorLoginButton text={text} align={"center"} />;
|
return <CasdoorLoginButton text={text} align={"center"} />;
|
||||||
|
Reference in New Issue
Block a user