File tree 3 files changed +16
-2
lines changed
client/packages/lowcoder/src
pages/userAuth/thirdParty
3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ export type ThirdPartyConfigType = {
57
57
url : string ;
58
58
name : string ;
59
59
logo : string ;
60
+ icon : string ;
60
61
// login source
61
62
sourceType : string ;
62
63
// url is react router
@@ -102,7 +103,7 @@ export const AuthRoutes: Array<{ path: string; component: React.ComponentType<an
102
103
103
104
export type ServerAuthType = "GOOGLE" | "GITHUB" | "FORM" | "KEYCLOAK" | "ORY" | "GENERIC" ;
104
105
105
- export type ServerAuthTypeInfoValueType = { logo ?: string ; isOAuth2 ?: boolean } ;
106
+ export type ServerAuthTypeInfoValueType = { logo ?: string ; sourceIcon ?: string ; isOAuth2 ?: boolean } ;
106
107
export const ServerAuthTypeInfo : { [ key in ServerAuthType ] ?: ServerAuthTypeInfoValueType } = {
107
108
GOOGLE : {
108
109
logo : GoogleLoginIcon ,
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ type OAuthConfig = {
35
35
authType : ServerAuthType ;
36
36
source : string ;
37
37
sourceName : string ;
38
+ sourceIcon ?: string ;
38
39
agentId ?: string ;
39
40
clientId ?: string ;
40
41
id ?: string ;
@@ -44,6 +45,7 @@ export type FormConfig = {
44
45
enableRegister ?: boolean ;
45
46
enable ?: boolean ;
46
47
authType : ServerAuthType ;
48
+ sourceIcon ?: string ;
47
49
source : string ;
48
50
sourceName : string ;
49
51
id ?: string ;
@@ -72,7 +74,13 @@ export type SystemConfig = {
72
74
export const transToSystemConfig = ( responseData : ConfigResponseData ) : SystemConfig => {
73
75
const thirdPartyAuthConfigs : ThirdPartyConfigType [ ] = [ ] ;
74
76
responseData . authConfigs ?. forEach ( ( authConfig ) => {
77
+
75
78
const logo = ServerAuthTypeInfo [ authConfig . authType ] ?. logo || GeneralLoginIcon ;
79
+ var icon = "" ;
80
+ if ( authConfig . authType === "GENERIC" && authConfig . sourceIcon ) {
81
+ icon = authConfig . sourceIcon ;
82
+ }
83
+
76
84
if ( isOAuthConfig ( authConfig ) ) {
77
85
const routeLinkConf : Partial < ThirdPartyConfigType > = isRouteLink ( authConfig . authType )
78
86
? {
@@ -82,6 +90,7 @@ export const transToSystemConfig = (responseData: ConfigResponseData): SystemCon
82
90
: { } ;
83
91
thirdPartyAuthConfigs . push ( {
84
92
logo : logo ,
93
+ icon : icon ,
85
94
name : authConfig . sourceName ,
86
95
url : authConfig . authorizeUrl ,
87
96
sourceType : authConfig . source ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { trans } from "i18n";
15
15
import { geneAuthStateAndSaveParam , getAuthUrl , getRedirectUrl } from "pages/userAuth/authUtils" ;
16
16
import { default as Divider } from "antd/es/divider" ;
17
17
import { useRedirectUrl } from "util/hooks" ;
18
+ import { MultiIconDisplay } from "../../../comps/comps/multiIconDisplay" ;
18
19
19
20
const ThirdPartyLoginButtonWrapper = styled . div `
20
21
button{
@@ -85,9 +86,12 @@ function ThirdPartyLoginButton(props: {
85
86
? `Sign up with ${ label } `
86
87
: `Sign in with ${ label } ` ;
87
88
89
+ console . log ( 'config' , config ) ;
90
+
88
91
return (
89
92
< 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 } /> }
91
95
< LoginLabelStyle className = "auth-label" >
92
96
{ buttonLabel }
93
97
</ LoginLabelStyle >
You can’t perform that action at this time.
0 commit comments