@authing/react-ui-components 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +2568 -201
- package/lib/index.min.css +2 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.LICENSE.txt +42 -0
- package/lib/static/media/loading.4a67a5f3.svg +29 -0
- package/package.json +54 -18
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -7
- package/.prettierrc +0 -5
- package/.vscode/settings.json +0 -31
- package/LICENSE +0 -21
- package/config/antdReplacer.js +0 -51
- package/config/env.js +0 -106
- package/config/getHttpsConfig.js +0 -66
- package/config/jest/cssTransform.js +0 -14
- package/config/jest/fileTransform.js +0 -40
- package/config/modules.js +0 -134
- package/config/paths.js +0 -71
- package/config/pnpTs.js +0 -35
- package/config/webpack.config.js +0 -857
- package/config/webpackDevServer.config.js +0 -130
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/scripts/build.js +0 -212
- package/scripts/lib.js +0 -200
- package/scripts/start.js +0 -166
- package/scripts/test.js +0 -53
- package/src/common/AuthingDropdown/index.tsx +0 -52
- package/src/common/AuthingDropdown/style.less +0 -43
- package/src/common/AuthingTabs/index.tsx +0 -98
- package/src/common/AuthingTabs/style.less +0 -135
- package/src/common/CopyAbleText/index.tsx +0 -54
- package/src/common/CopyAbleText/style.less +0 -13
- package/src/common/VerifyCodeInput/index.tsx +0 -76
- package/src/common/VerifyCodeInput/style.less +0 -24
- package/src/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
- package/src/components/AuthingGuard/AppMFALayout/style.less +0 -12
- package/src/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
- package/src/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
- package/src/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
- package/src/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
- package/src/components/AuthingGuard/Forms/Agreements/style.less +0 -44
- package/src/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
- package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -86
- package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
- package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
- package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
- package/src/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
- package/src/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
- package/src/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -161
- package/src/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
- package/src/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
- package/src/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
- package/src/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
- package/src/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
- package/src/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
- package/src/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
- package/src/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
- package/src/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
- package/src/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
- package/src/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
- package/src/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
- package/src/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -61
- package/src/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
- package/src/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
- package/src/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
- package/src/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
- package/src/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
- package/src/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
- package/src/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
- package/src/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
- package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
- package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
- package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
- package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
- package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
- package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
- package/src/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
- package/src/components/AuthingGuard/Forms/index.ts +0 -13
- package/src/components/AuthingGuard/GuardLayout/index.tsx +0 -488
- package/src/components/AuthingGuard/GuardLayout/style.less +0 -111
- package/src/components/AuthingGuard/Header/index.tsx +0 -28
- package/src/components/AuthingGuard/Header/style.less +0 -64
- package/src/components/AuthingGuard/IconFont/iconfont.js +0 -74
- package/src/components/AuthingGuard/IconFont/index.tsx +0 -19
- package/src/components/AuthingGuard/IconFont/style.less +0 -6
- package/src/components/AuthingGuard/IconFont/svg.js +0 -2
- package/src/components/AuthingGuard/LoginLayout/index.tsx +0 -205
- package/src/components/AuthingGuard/LoginLayout/style.less +0 -0
- package/src/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
- package/src/components/AuthingGuard/MfaLayout/index.tsx +0 -49
- package/src/components/AuthingGuard/MfaLayout/style.less +0 -3
- package/src/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
- package/src/components/AuthingGuard/RegisterLayout/style.less +0 -0
- package/src/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
- package/src/components/AuthingGuard/ToggleLang/index.tsx +0 -51
- package/src/components/AuthingGuard/api/appConfig.ts +0 -154
- package/src/components/AuthingGuard/api/http.ts +0 -88
- package/src/components/AuthingGuard/api/index.ts +0 -3
- package/src/components/AuthingGuard/api/sso.ts +0 -29
- package/src/components/AuthingGuard/api/userPoolConfig.ts +0 -112
- package/src/components/AuthingGuard/constants.ts +0 -107
- package/src/components/AuthingGuard/hooks/index.tsx +0 -70
- package/src/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
- package/src/components/AuthingGuard/index.tsx +0 -134
- package/src/components/AuthingGuard/locales/en/common.json +0 -185
- package/src/components/AuthingGuard/locales/en/index.ts +0 -6
- package/src/components/AuthingGuard/locales/en/login.json +0 -94
- package/src/components/AuthingGuard/locales/en/map.json +0 -4
- package/src/components/AuthingGuard/locales/en/user.json +0 -81
- package/src/components/AuthingGuard/locales/index.ts +0 -45
- package/src/components/AuthingGuard/locales/zh/common.json +0 -185
- package/src/components/AuthingGuard/locales/zh/index.ts +0 -6
- package/src/components/AuthingGuard/locales/zh/login.json +0 -94
- package/src/components/AuthingGuard/locales/zh/map.json +0 -4
- package/src/components/AuthingGuard/locales/zh/user.json +0 -81
- package/src/components/AuthingGuard/style.less +0 -104
- package/src/components/AuthingGuard/types/Forms.ts +0 -95
- package/src/components/AuthingGuard/types/GuardConfig.ts +0 -424
- package/src/components/AuthingGuard/types/GuardState.ts +0 -7
- package/src/components/AuthingGuard/types/Locales.ts +0 -12
- package/src/components/AuthingGuard/types/index.ts +0 -4
- package/src/components/index.ts +0 -7
- package/src/context/base.tsx +0 -28
- package/src/context/global/context.tsx +0 -39
- package/src/context/global/reducer.tsx +0 -56
- package/src/index.tsx +0 -142
- package/src/logo.svg +0 -7
- package/src/react-app-env.d.ts +0 -71
- package/src/reportWebVitals.ts +0 -15
- package/src/setupTests.ts +0 -5
- package/src/utils/clipboard.ts +0 -27
- package/src/utils/index.ts +0 -180
- package/src/utils/popupCenter.ts +0 -48
- package/tsconfig.json +0 -24
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
import qs from 'qs'
|
|
2
|
-
import shortid from 'shortid'
|
|
3
|
-
import React, { FC, useEffect } from 'react'
|
|
4
|
-
import { Button, Avatar, Space, Tooltip, message } from 'antd'
|
|
5
|
-
|
|
6
|
-
import { isWechatBrowser, popupCenter } from '../../../../utils'
|
|
7
|
-
import { useGuardContext } from '../../../../context/global/context'
|
|
8
|
-
import {
|
|
9
|
-
APP_MFA_CODE,
|
|
10
|
-
OTP_MFA_CODE,
|
|
11
|
-
} from '../../../../components/AuthingGuard/constants'
|
|
12
|
-
import {
|
|
13
|
-
Lang,
|
|
14
|
-
Protocol,
|
|
15
|
-
SocialAndIdpLoginProps,
|
|
16
|
-
} from '../../../../components/AuthingGuard/types'
|
|
17
|
-
import {
|
|
18
|
-
OIDCConnectionConfig,
|
|
19
|
-
ICasConnectionConfig,
|
|
20
|
-
ISamlConnectionConfig,
|
|
21
|
-
IAzureAdConnectionConfig,
|
|
22
|
-
IOAuthConnectionConfig,
|
|
23
|
-
} from '../../../../components/AuthingGuard/api'
|
|
24
|
-
import { requestClient } from '../../api/http'
|
|
25
|
-
|
|
26
|
-
import './style.less'
|
|
27
|
-
import { IconFont } from '../../IconFont'
|
|
28
|
-
import { useScreenSize } from '../../hooks/useScreenSize'
|
|
29
|
-
import { SocialConnectionProvider } from 'authing-js-sdk'
|
|
30
|
-
import { useTranslation } from 'react-i18next'
|
|
31
|
-
import { i18n } from '../../locales'
|
|
32
|
-
|
|
33
|
-
export const SocialAndIdpLogin: FC<SocialAndIdpLoginProps> = ({
|
|
34
|
-
onFail = () => {},
|
|
35
|
-
onSuccess = () => {},
|
|
36
|
-
}) => {
|
|
37
|
-
const {
|
|
38
|
-
state: { config, userPoolId, appId, authClient },
|
|
39
|
-
} = useGuardContext()
|
|
40
|
-
const { t } = useTranslation()
|
|
41
|
-
|
|
42
|
-
const noForm = !config.loginMethods?.length
|
|
43
|
-
|
|
44
|
-
const [screenSize] = useScreenSize()
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
const onMessage = (evt: MessageEvent) => {
|
|
48
|
-
// TODO: event.origin是指发送的消息源,一定要进行验证!!!
|
|
49
|
-
|
|
50
|
-
const { code, message: errMsg, data, event } = evt.data
|
|
51
|
-
|
|
52
|
-
const { source, eventType } = event || {}
|
|
53
|
-
|
|
54
|
-
// 社会化登录是用 authing-js-sdk 实现的,不用再在这里回调了
|
|
55
|
-
if (source === 'authing' && eventType === 'socialLogin') {
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
const parsedMsg = JSON.parse(errMsg)
|
|
61
|
-
const { code: authingCode } = parsedMsg
|
|
62
|
-
if ([OTP_MFA_CODE, APP_MFA_CODE].includes(authingCode)) {
|
|
63
|
-
onFail(parsedMsg)
|
|
64
|
-
return
|
|
65
|
-
}
|
|
66
|
-
} catch (e) {
|
|
67
|
-
// do nothing...
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (code !== undefined) {
|
|
71
|
-
if (code === 200) {
|
|
72
|
-
localStorage.setItem('_authing_token', data?.token)
|
|
73
|
-
onSuccess(data)
|
|
74
|
-
} else {
|
|
75
|
-
message.error(errMsg)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
window.addEventListener('message', onMessage)
|
|
80
|
-
return () => {
|
|
81
|
-
window.removeEventListener('message', onMessage)
|
|
82
|
-
}
|
|
83
|
-
}, [onFail, onSuccess])
|
|
84
|
-
|
|
85
|
-
const idpButtons = config.enterpriseConnectionObjs.map((i) => {
|
|
86
|
-
if (i.protocol === Protocol.OIDC) {
|
|
87
|
-
const configItem = i.config as OIDCConnectionConfig
|
|
88
|
-
const state = shortid.generate()
|
|
89
|
-
|
|
90
|
-
const query = qs.stringify({
|
|
91
|
-
client_id: configItem.clientId,
|
|
92
|
-
redirect_uri: configItem.redirectUri,
|
|
93
|
-
scope: configItem.scopes,
|
|
94
|
-
response_type: configItem.responseType,
|
|
95
|
-
state,
|
|
96
|
-
nonce: shortid.generate(),
|
|
97
|
-
})
|
|
98
|
-
const url = `${configItem.authorizationEdpoint}?${query}`
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<Button
|
|
102
|
-
key={i.identifier}
|
|
103
|
-
className="authing-guard-third-login-btn"
|
|
104
|
-
block
|
|
105
|
-
size="large"
|
|
106
|
-
icon={<Avatar size={20} src={i.logo} style={{ marginRight: 8 }} />}
|
|
107
|
-
onClick={async () => {
|
|
108
|
-
await requestClient.post(
|
|
109
|
-
'/api/v2/connections/oidc/start-interaction',
|
|
110
|
-
{
|
|
111
|
-
state,
|
|
112
|
-
protocol: i.protocol,
|
|
113
|
-
userPoolId,
|
|
114
|
-
appId,
|
|
115
|
-
referer: window.location.href,
|
|
116
|
-
connection: { providerIentifier: i.identifier },
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
popupCenter(url)
|
|
120
|
-
}}
|
|
121
|
-
>
|
|
122
|
-
{t('login.loginBy', {
|
|
123
|
-
name: i.displayName,
|
|
124
|
-
})}
|
|
125
|
-
</Button>
|
|
126
|
-
)
|
|
127
|
-
} else if (i.protocol === Protocol.SAML) {
|
|
128
|
-
const config = i.config as ISamlConnectionConfig
|
|
129
|
-
return (
|
|
130
|
-
<Button
|
|
131
|
-
key={i.identifier}
|
|
132
|
-
className="authing-guard-third-login-btn"
|
|
133
|
-
block
|
|
134
|
-
size="large"
|
|
135
|
-
icon={<Avatar size={20} src={i.logo} style={{ marginRight: 8 }} />}
|
|
136
|
-
onClick={async () => {
|
|
137
|
-
popupCenter(config.samlRequest!)
|
|
138
|
-
}}
|
|
139
|
-
>
|
|
140
|
-
{t('login.loginBy', {
|
|
141
|
-
name: i.displayName,
|
|
142
|
-
})}
|
|
143
|
-
</Button>
|
|
144
|
-
)
|
|
145
|
-
} else if (i.protocol === Protocol.CAS) {
|
|
146
|
-
const config = i.config as ICasConnectionConfig
|
|
147
|
-
|
|
148
|
-
return (
|
|
149
|
-
<Button
|
|
150
|
-
key={i.identifier}
|
|
151
|
-
className="authing-guard-third-login-btn"
|
|
152
|
-
block
|
|
153
|
-
size="large"
|
|
154
|
-
icon={<Avatar size={20} src={i.logo} style={{ marginRight: 8 }} />}
|
|
155
|
-
onClick={async () => {
|
|
156
|
-
popupCenter(config.casConnectionLoginUrl!)
|
|
157
|
-
}}
|
|
158
|
-
>
|
|
159
|
-
{t('login.loginBy', {
|
|
160
|
-
name: i.displayName,
|
|
161
|
-
})}
|
|
162
|
-
</Button>
|
|
163
|
-
)
|
|
164
|
-
} else if (i.protocol === Protocol.OAUTH) {
|
|
165
|
-
const config = i.config as IOAuthConnectionConfig
|
|
166
|
-
|
|
167
|
-
return (
|
|
168
|
-
<Button
|
|
169
|
-
key={i.identifier}
|
|
170
|
-
className="authing-guard-third-login-btn"
|
|
171
|
-
block
|
|
172
|
-
size="large"
|
|
173
|
-
icon={<Avatar size={20} src={i.logo} style={{ marginRight: 8 }} />}
|
|
174
|
-
onClick={async () => {
|
|
175
|
-
popupCenter(config.authUrl!)
|
|
176
|
-
}}
|
|
177
|
-
>
|
|
178
|
-
{t('login.loginBy', {
|
|
179
|
-
name: i.displayName,
|
|
180
|
-
})}
|
|
181
|
-
</Button>
|
|
182
|
-
)
|
|
183
|
-
} else if (i.protocol === Protocol.AZURE_AD) {
|
|
184
|
-
const configItem = i.config as IAzureAdConnectionConfig
|
|
185
|
-
return (
|
|
186
|
-
<Button
|
|
187
|
-
key={i.identifier}
|
|
188
|
-
className="authing-guard-third-login-btn"
|
|
189
|
-
block
|
|
190
|
-
size="large"
|
|
191
|
-
icon={<Avatar size={20} src={i.logo} style={{ marginRight: 8 }} />}
|
|
192
|
-
onClick={async () => {
|
|
193
|
-
popupCenter(configItem.authorizationUrl)
|
|
194
|
-
}}
|
|
195
|
-
>
|
|
196
|
-
{t('login.loginBy', {
|
|
197
|
-
name: i.displayName,
|
|
198
|
-
})}
|
|
199
|
-
</Button>
|
|
200
|
-
)
|
|
201
|
-
} else {
|
|
202
|
-
return null
|
|
203
|
-
}
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
const socialLoginButtons = config.socialConnectionObjs
|
|
207
|
-
.filter((item) =>
|
|
208
|
-
isWechatBrowser()
|
|
209
|
-
? item.provider === SocialConnectionProvider.WECHATMP
|
|
210
|
-
: item.provider !== SocialConnectionProvider.WECHATMP
|
|
211
|
-
)
|
|
212
|
-
.map((item) => {
|
|
213
|
-
const iconType = `authing-${item.provider.replace(/:/g, '-')}`
|
|
214
|
-
|
|
215
|
-
const authorization_params: Record<string, any> = {}
|
|
216
|
-
if (item.provider === SocialConnectionProvider.BAIDU) {
|
|
217
|
-
authorization_params.display = screenSize
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
const onLogin = () => {
|
|
221
|
-
authClient.social.authorize(item.identifier, {
|
|
222
|
-
onSuccess(user) {
|
|
223
|
-
onSuccess(user)
|
|
224
|
-
},
|
|
225
|
-
onError(code, msg) {
|
|
226
|
-
try {
|
|
227
|
-
const parsedMsg = JSON.parse(msg)
|
|
228
|
-
const { code: authingCode } = parsedMsg
|
|
229
|
-
if ([OTP_MFA_CODE, APP_MFA_CODE].includes(authingCode)) {
|
|
230
|
-
onFail(parsedMsg)
|
|
231
|
-
return
|
|
232
|
-
}
|
|
233
|
-
} catch (e) {
|
|
234
|
-
// do nothing...
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
message.error(msg)
|
|
238
|
-
},
|
|
239
|
-
authorization_params,
|
|
240
|
-
})
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return noForm ? (
|
|
244
|
-
<Button
|
|
245
|
-
key={item.provider}
|
|
246
|
-
block
|
|
247
|
-
size="large"
|
|
248
|
-
className="authing-guard-third-login-btn"
|
|
249
|
-
icon={
|
|
250
|
-
<IconFont
|
|
251
|
-
type={iconType}
|
|
252
|
-
style={{ fontSize: 20, marginRight: 8 }}
|
|
253
|
-
/>
|
|
254
|
-
}
|
|
255
|
-
onClick={onLogin}
|
|
256
|
-
>
|
|
257
|
-
{item.tooltip?.[i18n.language as Lang] || item.displayName}
|
|
258
|
-
</Button>
|
|
259
|
-
) : (
|
|
260
|
-
<Tooltip
|
|
261
|
-
key={item.provider}
|
|
262
|
-
title={item.tooltip?.[i18n.language as Lang] || item.displayName}
|
|
263
|
-
>
|
|
264
|
-
<div className="authing-social-login-item" onClick={onLogin}>
|
|
265
|
-
<IconFont type={iconType} />
|
|
266
|
-
</div>
|
|
267
|
-
</Tooltip>
|
|
268
|
-
)
|
|
269
|
-
})
|
|
270
|
-
|
|
271
|
-
const idp =
|
|
272
|
-
config.enterpriseConnectionObjs.length > 0 ? (
|
|
273
|
-
<>
|
|
274
|
-
{!noForm && <div className="authing-social-login-title">OR</div>}
|
|
275
|
-
<Space
|
|
276
|
-
size={12}
|
|
277
|
-
className="authing-guard-full-width-space"
|
|
278
|
-
direction="vertical"
|
|
279
|
-
>
|
|
280
|
-
{idpButtons}
|
|
281
|
-
</Space>
|
|
282
|
-
</>
|
|
283
|
-
) : null
|
|
284
|
-
|
|
285
|
-
const socialLogin =
|
|
286
|
-
socialLoginButtons.length > 0 && noForm ? (
|
|
287
|
-
<Space
|
|
288
|
-
size={12}
|
|
289
|
-
className="authing-guard-full-width-space"
|
|
290
|
-
direction="vertical"
|
|
291
|
-
>
|
|
292
|
-
{socialLoginButtons}
|
|
293
|
-
</Space>
|
|
294
|
-
) : (
|
|
295
|
-
socialLoginButtons.length > 0 && (
|
|
296
|
-
<>
|
|
297
|
-
<div className="authing-social-login-title">
|
|
298
|
-
{t('login.thridAccLogin')}
|
|
299
|
-
</div>
|
|
300
|
-
<div className="authing-social-login-list">{socialLoginButtons}</div>
|
|
301
|
-
</>
|
|
302
|
-
)
|
|
303
|
-
)
|
|
304
|
-
|
|
305
|
-
return (
|
|
306
|
-
<>
|
|
307
|
-
{!noForm && (
|
|
308
|
-
<div
|
|
309
|
-
style={{
|
|
310
|
-
flex: 1,
|
|
311
|
-
minHeight: 26,
|
|
312
|
-
}}
|
|
313
|
-
></div>
|
|
314
|
-
)}
|
|
315
|
-
<Space
|
|
316
|
-
size={12}
|
|
317
|
-
direction="vertical"
|
|
318
|
-
className="authing-guard-full-width-space"
|
|
319
|
-
>
|
|
320
|
-
{idp}
|
|
321
|
-
{socialLogin}
|
|
322
|
-
</Space>
|
|
323
|
-
</>
|
|
324
|
-
)
|
|
325
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
.authing-guard-third-login-btn {
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.authing-social-login-item {
|
|
8
|
-
display: inline-flex;
|
|
9
|
-
margin: 8px 8px;
|
|
10
|
-
width: 48px;
|
|
11
|
-
height: 48px;
|
|
12
|
-
background-color: #eff1f6;
|
|
13
|
-
border-radius: 50%;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
align-items: center;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
user-select: none;
|
|
18
|
-
|
|
19
|
-
.authing-icon {
|
|
20
|
-
font-size: 20px;
|
|
21
|
-
color: #aeb9d4;
|
|
22
|
-
transition: color 0.3s ease-in-out;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&:hover .authing-icon {
|
|
26
|
-
color: #396aff;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.authing-social-login-title {
|
|
31
|
-
text-align: center;
|
|
32
|
-
font-size: 14px;
|
|
33
|
-
color: #999999;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.authing-social-login-title::before,
|
|
37
|
-
.authing-social-login-title::after {
|
|
38
|
-
content: '——';
|
|
39
|
-
color: #eeeeee;
|
|
40
|
-
margin: 0 11px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.authing-social-login-list {
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-wrap: wrap;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@media only screen and (max-width: 719px) {
|
|
50
|
-
.authing-social-login-title {
|
|
51
|
-
font-size: 12px;
|
|
52
|
-
}
|
|
53
|
-
.authing-social-login-item {
|
|
54
|
-
width: 32px;
|
|
55
|
-
height: 32px;
|
|
56
|
-
.authing-icon {
|
|
57
|
-
font-size: 16px;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
.authing-guard-full-width-space {
|
|
61
|
-
.authing-ant-space-item {
|
|
62
|
-
margin-bottom: 16px !important;
|
|
63
|
-
display: flex;
|
|
64
|
-
justify-content: center;
|
|
65
|
-
.authing-ant-btn {
|
|
66
|
-
width: 200px;
|
|
67
|
-
height: 34px;
|
|
68
|
-
background: #ffffff;
|
|
69
|
-
border-radius: 18px;
|
|
70
|
-
border: 1px solid #e7e7e7;
|
|
71
|
-
font-size: 12px;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { PlusOutlined } from '@ant-design/icons'
|
|
2
|
-
import { message, Spin, Upload } from 'antd'
|
|
3
|
-
import { UploadChangeParam } from 'antd/lib/upload'
|
|
4
|
-
import React, { FC, useState } from 'react'
|
|
5
|
-
import { useTranslation } from 'react-i18next'
|
|
6
|
-
import { useGuardContext } from '../../../../context/global/context'
|
|
7
|
-
|
|
8
|
-
export const UploadImage: FC<{
|
|
9
|
-
value?: string
|
|
10
|
-
onChange?: (value: string) => void
|
|
11
|
-
}> = ({ value, onChange }) => {
|
|
12
|
-
const [uploading, setUploading] = useState(false)
|
|
13
|
-
const { t } = useTranslation()
|
|
14
|
-
const {
|
|
15
|
-
state: {
|
|
16
|
-
config: { apiHost },
|
|
17
|
-
},
|
|
18
|
-
} = useGuardContext()
|
|
19
|
-
|
|
20
|
-
const onStatusChange = (info: UploadChangeParam) => {
|
|
21
|
-
const { status } = info.file
|
|
22
|
-
|
|
23
|
-
if (status === 'uploading') {
|
|
24
|
-
setUploading(true)
|
|
25
|
-
} else {
|
|
26
|
-
setUploading(false)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (status === 'done') {
|
|
30
|
-
const { code, message: errMsg, data } = info.file.response
|
|
31
|
-
if (code !== 200) {
|
|
32
|
-
return message.error(errMsg)
|
|
33
|
-
}
|
|
34
|
-
const { url } = data
|
|
35
|
-
onChange?.(url)
|
|
36
|
-
} else if (status === 'error') {
|
|
37
|
-
message.error(
|
|
38
|
-
t('common.uploadFail', {
|
|
39
|
-
name: info.file.name,
|
|
40
|
-
})
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const uploadButton = (
|
|
46
|
-
<div>
|
|
47
|
-
<PlusOutlined />
|
|
48
|
-
<div style={{ marginTop: 8 }}>Upload</div>
|
|
49
|
-
</div>
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Upload
|
|
54
|
-
name="file"
|
|
55
|
-
accept="image/*"
|
|
56
|
-
listType="picture-card"
|
|
57
|
-
showUploadList={false}
|
|
58
|
-
action={`${apiHost}/api/v2/upload?folder=photos`}
|
|
59
|
-
onChange={onStatusChange}
|
|
60
|
-
>
|
|
61
|
-
<Spin size="small" spinning={uploading}>
|
|
62
|
-
{value ? (
|
|
63
|
-
<img src={value} alt="" style={{ width: '100%' }} />
|
|
64
|
-
) : (
|
|
65
|
-
uploadButton
|
|
66
|
-
)}
|
|
67
|
-
</Spin>
|
|
68
|
-
</Upload>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './ADLoginForm'
|
|
2
|
-
export * from './ResetPwdForm'
|
|
3
|
-
export * from './MfaVerifyForm'
|
|
4
|
-
export * from './LdapLoginForm'
|
|
5
|
-
export * from './QrCodeLoginForm'
|
|
6
|
-
export * from './MfaResetCodeForm'
|
|
7
|
-
export * from './EmailRegisterForm'
|
|
8
|
-
export * from './PhoneRegisterForm'
|
|
9
|
-
export * from './PasswordLoginForm'
|
|
10
|
-
export * from './SocialAndIdpLogin'
|
|
11
|
-
export * from './PhoneCodeLoginForm'
|
|
12
|
-
export * from './SmsMfaVerifyForm'
|
|
13
|
-
export * from './EmailMfaVerifyForm'
|