File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
client/packages/lowcoder/src
pages/userAuth/thirdParty Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ export type ThirdPartyConfigType = {
5757 url : string ;
5858 name : string ;
5959 logo : string ;
60+ icon : string ;
6061 // login source
6162 sourceType : string ;
6263 // url is react router
@@ -102,7 +103,7 @@ export const AuthRoutes: Array<{ path: string; component: React.ComponentType<an
102103
103104export type ServerAuthType = "GOOGLE" | "GITHUB" | "FORM" | "KEYCLOAK" | "ORY" | "GENERIC" ;
104105
105- export type ServerAuthTypeInfoValueType = { logo ?: string ; isOAuth2 ?: boolean } ;
106+ export type ServerAuthTypeInfoValueType = { logo ?: string ; sourceIcon ?: string ; isOAuth2 ?: boolean } ;
106107export const ServerAuthTypeInfo : { [ key in ServerAuthType ] ?: ServerAuthTypeInfoValueType } = {
107108 GOOGLE : {
108109 logo : GoogleLoginIcon ,
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ type OAuthConfig = {
3535 authType : ServerAuthType ;
3636 source : string ;
3737 sourceName : string ;
38+ sourceIcon ?: string ;
3839 agentId ?: string ;
3940 clientId ?: string ;
4041 id ?: string ;
@@ -44,6 +45,7 @@ export type FormConfig = {
4445 enableRegister ?: boolean ;
4546 enable ?: boolean ;
4647 authType : ServerAuthType ;
48+ sourceIcon ?: string ;
4749 source : string ;
4850 sourceName : string ;
4951 id ?: string ;
@@ -72,7 +74,13 @@ export type SystemConfig = {
7274export const transToSystemConfig = ( responseData : ConfigResponseData ) : SystemConfig => {
7375 const thirdPartyAuthConfigs : ThirdPartyConfigType [ ] = [ ] ;
7476 responseData . authConfigs ?. forEach ( ( authConfig ) => {
77+
7578 const logo = ServerAuthTypeInfo [ authConfig . authType ] ?. logo || GeneralLoginIcon ;
79+ var icon = "" ;
80+ if ( authConfig . authType === "GENERIC" && authConfig . sourceIcon ) {
81+ icon = authConfig . sourceIcon ;
82+ }
83+
7684 if ( isOAuthConfig ( authConfig ) ) {
7785 const routeLinkConf : Partial < ThirdPartyConfigType > = isRouteLink ( authConfig . authType )
7886 ? {
@@ -82,6 +90,7 @@ export const transToSystemConfig = (responseData: ConfigResponseData): SystemCon
8290 : { } ;
8391 thirdPartyAuthConfigs . push ( {
8492 logo : logo ,
93+ icon : icon ,
8594 name : authConfig . sourceName ,
8695 url : authConfig . authorizeUrl ,
8796 sourceType : authConfig . source ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { trans } from "i18n";
1515import { geneAuthStateAndSaveParam , getAuthUrl , getRedirectUrl } from "pages/userAuth/authUtils" ;
1616import { default as Divider } from "antd/es/divider" ;
1717import { useRedirectUrl } from "util/hooks" ;
18+ import { MultiIconDisplay } from "../../../comps/comps/multiIconDisplay" ;
1819
1920const ThirdPartyLoginButtonWrapper = styled . div `
2021 button{
@@ -85,9 +86,12 @@ function ThirdPartyLoginButton(props: {
8586 ? `Sign up with ${ label } `
8687 : `Sign in with ${ label } ` ;
8788
89+ console . log ( 'config' , config ) ;
90+
8891 return (
8992 < StyledLoginButton buttonType = "normal" onClick = { onLoginClick } >
90- < LoginLogoStyle alt = { config . name } src = { config . logo } title = { config . name } />
93+ { config . icon && < MultiIconDisplay identifier = { config . icon } width = "20px" height = "20px" style = { { marginRight : "20px" , flexShrink : 0 , color : "#000" } } /> }
94+ { ! config . icon && < LoginLogoStyle alt = { config . name } src = { config . logo } title = { config . name } /> }
9195 < LoginLabelStyle className = "auth-label" >
9296 { buttonLabel }
9397 </ LoginLabelStyle >
You can’t perform that action at this time.
0 commit comments