diff --git a/web/src/auth/LoginButton.js b/web/src/auth/LoginButton.js index d01eeff0..0acc4da9 100644 --- a/web/src/auth/LoginButton.js +++ b/web/src/auth/LoginButton.js @@ -14,11 +14,10 @@ import i18next from "i18next"; import {createButton} from "react-social-login-buttons"; -import {StaticBaseUrl} from "../Setting"; -function LoginButton({type, align = "center", style = {background: "#ffffff", color: "#000000"}, activeStyle = {background: "#ededee"}}) { +function LoginButton({type, logoUrl, align = "center", style = {background: "#ffffff", color: "#000000"}, activeStyle = {background: "#ededee"}}) { function Icon({width = 24, height = 24, color}) { - return {`Sign; + return {`Sign; } const config = { text: `Sign in with ${type}`, diff --git a/web/src/auth/ProviderButton.js b/web/src/auth/ProviderButton.js index f7fed31a..d3b5fd90 100644 --- a/web/src/auth/ProviderButton.js +++ b/web/src/auth/ProviderButton.js @@ -44,62 +44,62 @@ import * as AuthBackend from "./AuthBackend"; import {getEvent} from "./Util"; import {Modal} from "antd"; -function getSigninButton(type) { - const text = i18next.t("login:Sign in with {type}").replace("{type}", type); - if (type === "GitHub") { +function getSigninButton(provider) { + const text = i18next.t("login:Sign in with {type}").replace("{type}", provider.type); + if (provider.type === "GitHub") { return ; - } else if (type === "Google") { + } else if (provider.type === "Google") { return ; - } else if (type === "QQ") { + } else if (provider.type === "QQ") { return ; - } else if (type === "Facebook") { + } else if (provider.type === "Facebook") { return ; - } else if (type === "Weibo") { + } else if (provider.type === "Weibo") { return ; - } else if (type === "Gitee") { + } else if (provider.type === "Gitee") { return ; - } else if (type === "WeChat") { + } else if (provider.type === "WeChat") { return ; - } else if (type === "DingTalk") { + } else if (provider.type === "DingTalk") { return ; - } else if (type === "LinkedIn") { + } else if (provider.type === "LinkedIn") { return ; - } else if (type === "WeCom") { + } else if (provider.type === "WeCom") { return ; - } else if (type === "Lark") { + } else if (provider.type === "Lark") { return ; - } else if (type === "GitLab") { + } else if (provider.type === "GitLab") { return ; - } else if (type === "Adfs") { + } else if (provider.type === "Adfs") { return ; - } else if (type === "Casdoor") { + } else if (provider.type === "Casdoor") { return ; - } else if (type === "Baidu") { + } else if (provider.type === "Baidu") { return ; - } else if (type === "Alipay") { + } else if (provider.type === "Alipay") { return ; - } else if (type === "Infoflow") { + } else if (provider.type === "Infoflow") { return ; - } else if (type === "Apple") { + } else if (provider.type === "Apple") { return ; - } else if (type === "AzureAD") { + } else if (provider.type === "AzureAD") { return ; - } else if (type === "Slack") { + } else if (provider.type === "Slack") { return ; - } else if (type === "Steam") { + } else if (provider.type === "Steam") { return ; - } else if (type === "Bilibili") { + } else if (provider.type === "Bilibili") { return ; - } else if (type === "Okta") { + } else if (provider.type === "Okta") { return ; - } else if (type === "Douyin") { + } else if (provider.type === "Douyin") { return ; } else { - return ; + return ; } } -function getSamlUrl(provider, location) { +function goToSamlUrl(provider, location) { const params = new URLSearchParams(location.search); const clientId = params.get("client_id") ?? ""; const state = params.get("state"); @@ -149,12 +149,11 @@ export function renderProviderLogo(provider, application, width, margin, size, l } } else if (provider.category === "SAML") { return ( - getSamlUrl(provider, location)}> + goToSamlUrl(provider, location)}> {provider.displayName} ); } - } else if (provider.type === "Custom") { // style definition const text = i18next.t("login:Sign in with {type}").replace("{type}", provider.displayName); @@ -173,7 +172,7 @@ export function renderProviderLogo(provider, application, width, margin, size, l ); } else if (provider.category === "SAML") { return ( - getSamlUrl(provider, location)} style={customAStyle}> + goToSamlUrl(provider, location)} style={customAStyle}>