@authing/react-ui-components 3.0.2-beta.5 → 3.0.3

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.
Files changed (262) hide show
  1. package/lib/index.d.ts +749 -54
  2. package/lib/index.min.css +2 -2
  3. package/lib/index.min.js +1 -1
  4. package/lib/index.min.js.LICENSE.txt +10 -0
  5. package/package.json +35 -12
  6. package/.eslintignore +0 -6
  7. package/.eslintrc.js +0 -7
  8. package/.prettierrc +0 -5
  9. package/.vscode/settings.json +0 -31
  10. package/build/asset-manifest.json +0 -26
  11. package/build/favicon.ico +0 -0
  12. package/build/index.html +0 -1
  13. package/build/logo192.png +0 -0
  14. package/build/logo512.png +0 -0
  15. package/build/manifest.json +0 -25
  16. package/build/robots.txt +0 -3
  17. package/build/static/css/2.51c07e65.chunk.css +0 -3
  18. package/build/static/css/2.51c07e65.chunk.css.map +0 -1
  19. package/build/static/css/main.779f221a.chunk.css +0 -2
  20. package/build/static/css/main.779f221a.chunk.css.map +0 -1
  21. package/build/static/js/2.bbae9fdb.chunk.js +0 -3
  22. package/build/static/js/2.bbae9fdb.chunk.js.LICENSE.txt +0 -102
  23. package/build/static/js/2.bbae9fdb.chunk.js.map +0 -1
  24. package/build/static/js/3.fd17f196.chunk.js +0 -2
  25. package/build/static/js/3.fd17f196.chunk.js.map +0 -1
  26. package/build/static/js/main.5f341531.chunk.js +0 -2
  27. package/build/static/js/main.5f341531.chunk.js.map +0 -1
  28. package/build/static/js/runtime-main.ef138021.js +0 -2
  29. package/build/static/js/runtime-main.ef138021.js.map +0 -1
  30. package/build/static/media/loading.4a67a5f3.svg +0 -29
  31. package/components/AuthingDropdown/index.tsx +0 -52
  32. package/components/AuthingDropdown/style.less +0 -43
  33. package/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  34. package/components/AuthingGuard/AppMFALayout/style.less +0 -12
  35. package/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  36. package/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  37. package/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  38. package/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  39. package/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  40. package/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  41. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -84
  42. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  43. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  44. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  45. package/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  46. package/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  47. package/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -166
  48. package/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  49. package/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  50. package/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  51. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  52. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  53. package/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  54. package/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  55. package/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  56. package/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  57. package/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  58. package/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  59. package/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  60. package/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -59
  61. package/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  62. package/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  63. package/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  64. package/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  65. package/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  66. package/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  67. package/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  68. package/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  69. package/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  70. package/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  71. package/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  72. package/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  73. package/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  74. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  75. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  76. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  77. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  78. package/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  79. package/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  80. package/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  81. package/components/AuthingGuard/Forms/index.ts +0 -13
  82. package/components/AuthingGuard/GuardLayout/index.tsx +0 -474
  83. package/components/AuthingGuard/GuardLayout/style.less +0 -111
  84. package/components/AuthingGuard/Header/index.tsx +0 -25
  85. package/components/AuthingGuard/Header/style.less +0 -52
  86. package/components/AuthingGuard/IconFont/iconfont.js +0 -74
  87. package/components/AuthingGuard/IconFont/index.tsx +0 -19
  88. package/components/AuthingGuard/IconFont/style.less +0 -6
  89. package/components/AuthingGuard/IconFont/svg.js +0 -2
  90. package/components/AuthingGuard/LoginLayout/index.tsx +0 -161
  91. package/components/AuthingGuard/LoginLayout/style.less +0 -0
  92. package/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  93. package/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  94. package/components/AuthingGuard/MfaLayout/style.less +0 -3
  95. package/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  96. package/components/AuthingGuard/RegisterLayout/style.less +0 -0
  97. package/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  98. package/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  99. package/components/AuthingGuard/api/appConfig.ts +0 -146
  100. package/components/AuthingGuard/api/index.ts +0 -3
  101. package/components/AuthingGuard/api/sso.ts +0 -29
  102. package/components/AuthingGuard/api/userPoolConfig.ts +0 -111
  103. package/components/AuthingGuard/constants.ts +0 -107
  104. package/components/AuthingGuard/hooks/index.tsx +0 -70
  105. package/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  106. package/components/AuthingGuard/index.tsx +0 -126
  107. package/components/AuthingGuard/style.less +0 -103
  108. package/components/AuthingGuard/types/Forms.ts +0 -94
  109. package/components/AuthingGuard/types/GuardConfig.ts +0 -420
  110. package/components/AuthingGuard/types/GuardState.ts +0 -7
  111. package/components/AuthingGuard/types/Locales.ts +0 -12
  112. package/components/AuthingGuard/types/index.ts +0 -4
  113. package/components/AuthingTabs/index.tsx +0 -98
  114. package/components/AuthingTabs/style.less +0 -135
  115. package/components/BindTotp/core/bindSuccess.tsx +0 -72
  116. package/components/BindTotp/core/securityCode.tsx +0 -108
  117. package/components/BindTotp/index.tsx +0 -134
  118. package/components/BindTotp/interface.ts +0 -30
  119. package/components/BindTotp/styles.less +0 -57
  120. package/components/ChangeLanguage/index.tsx +0 -35
  121. package/components/ChangePassword/core/firstLoginReset.tsx +0 -111
  122. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  123. package/components/ChangePassword/index.tsx +0 -72
  124. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  125. package/components/CompleteInfo/index.tsx +0 -45
  126. package/components/CompleteInfo/interface.ts +0 -40
  127. package/components/CompleteInfo/styles.less +0 -7
  128. package/components/CopyAbleText/index.tsx +0 -54
  129. package/components/CopyAbleText/style.less +0 -13
  130. package/components/DownloadAuthenticator/index.tsx +0 -97
  131. package/components/DownloadAuthenticator/interface.ts +0 -22
  132. package/components/DownloadAuthenticator/styles.less +0 -52
  133. package/components/Error/index.tsx +0 -21
  134. package/components/Error/interface.ts +0 -9
  135. package/components/Error/styles.less +0 -12
  136. package/components/ForgetPassword/core/resetPassword.tsx +0 -162
  137. package/components/ForgetPassword/index.tsx +0 -78
  138. package/components/ForgetPassword/interface.ts +0 -32
  139. package/components/Guard/Guard.tsx +0 -295
  140. package/components/Guard/authClient.ts +0 -44
  141. package/components/Guard/config.ts +0 -19
  142. package/components/Guard/event.ts +0 -52
  143. package/components/Guard/index.tsx +0 -4
  144. package/components/Guard/module.ts +0 -20
  145. package/components/Guard/stateMachine.ts +0 -152
  146. package/components/Guard/styles.less +0 -461
  147. package/components/IconFont/iconfont.js +0 -74
  148. package/components/IconFont/index.tsx +0 -16
  149. package/components/IconFont/style.less +0 -6
  150. package/components/IconFont/svg.js +0 -2
  151. package/components/ImagePro/index.tsx +0 -53
  152. package/components/ImagePro/styles.less +0 -40
  153. package/components/InputNumber/index.tsx +0 -33
  154. package/components/Login/codemap.ts +0 -49
  155. package/components/Login/core/withAD.tsx +0 -9
  156. package/components/Login/core/withAppQrcode.tsx +0 -49
  157. package/components/Login/core/withLDAP.tsx +0 -146
  158. package/components/Login/core/withPassword/FormItemAccount.tsx +0 -42
  159. package/components/Login/core/withPassword/GraphicVerifyCode.tsx +0 -30
  160. package/components/Login/core/withPassword/InputAccount.tsx +0 -64
  161. package/components/Login/core/withPassword/index.tsx +0 -173
  162. package/components/Login/core/withPhonecode.tsx +0 -122
  163. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  164. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  165. package/components/Login/index.tsx +0 -374
  166. package/components/Login/props.ts +0 -74
  167. package/components/Login/socialLogin/index.tsx +0 -407
  168. package/components/Login/socialLogin/style.less +0 -69
  169. package/components/Login/styles.less +0 -53
  170. package/components/MFA/VerifyCodeInput/VerifyCodeFormItem.tsx +0 -41
  171. package/components/MFA/VerifyCodeInput/index.tsx +0 -145
  172. package/components/MFA/VerifyCodeInput/style.less +0 -35
  173. package/components/MFA/codemap.ts +0 -24
  174. package/components/MFA/core/email.tsx +0 -203
  175. package/components/MFA/core/face.tsx +0 -297
  176. package/components/MFA/core/face_deps.tsx +0 -37
  177. package/components/MFA/core/sms.tsx +0 -203
  178. package/components/MFA/core/totp.tsx +0 -122
  179. package/components/MFA/index.tsx +0 -143
  180. package/components/MFA/mfaMethods/index.tsx +0 -88
  181. package/components/MFA/mfaMethods/style.less +0 -39
  182. package/components/MFA/props.ts +0 -51
  183. package/components/MFA/styles.less +0 -100
  184. package/components/NeedHelpView/core/describeQuestions.tsx +0 -245
  185. package/components/NeedHelpView/index.tsx +0 -47
  186. package/components/RecoveryCode/core/useCode.tsx +0 -71
  187. package/components/RecoveryCode/index.tsx +0 -27
  188. package/components/RecoveryCode/interface.ts +0 -31
  189. package/components/RecoveryCode/style.less +0 -13
  190. package/components/Register/codemap.ts +0 -12
  191. package/components/Register/components/Agreements/index.tsx +0 -81
  192. package/components/Register/components/Agreements/style.less +0 -44
  193. package/components/Register/core/WithEmail.tsx +0 -242
  194. package/components/Register/core/WithPhone.tsx +0 -184
  195. package/components/Register/index.tsx +0 -139
  196. package/components/Register/props.ts +0 -50
  197. package/components/SendCode/SendCodeBtn.tsx +0 -96
  198. package/components/SendCode/index.tsx +0 -94
  199. package/components/SendCode/style.less +0 -31
  200. package/components/ShieldSpin/index.tsx +0 -27
  201. package/components/ShieldSpin/loading.svg +0 -29
  202. package/components/SubmitButton/index.tsx +0 -50
  203. package/components/SubmitSuccess/index.tsx +0 -66
  204. package/components/SubmitSuccess/interface.ts +0 -17
  205. package/components/Type/index.ts +0 -52
  206. package/components/ValidatorRules/ValidatorFormItem.tsx +0 -139
  207. package/components/ValidatorRules/index.ts +0 -20
  208. package/components/VerifyCodeInput/index.tsx +0 -76
  209. package/components/VerifyCodeInput/style.less +0 -24
  210. package/components/_utils/GuardErrorCode.ts +0 -9
  211. package/components/_utils/clipboard.ts +0 -27
  212. package/components/_utils/config.ts +0 -116
  213. package/components/_utils/guradHttp.ts +0 -101
  214. package/components/_utils/hooks/index.ts +0 -64
  215. package/components/_utils/http.ts +0 -85
  216. package/components/_utils/index.ts +0 -326
  217. package/components/_utils/locales/en/common.json +0 -229
  218. package/components/_utils/locales/en/index.ts +0 -6
  219. package/components/_utils/locales/en/login.json +0 -96
  220. package/components/_utils/locales/en/map.json +0 -4
  221. package/components/_utils/locales/en/user.json +0 -82
  222. package/components/_utils/locales/index.ts +0 -45
  223. package/components/_utils/locales/zh/common.json +0 -229
  224. package/components/_utils/locales/zh/index.ts +0 -6
  225. package/components/_utils/locales/zh/login.json +0 -96
  226. package/components/_utils/locales/zh/map.json +0 -4
  227. package/components/_utils/locales/zh/user.json +0 -83
  228. package/components/_utils/popupCenter.ts +0 -48
  229. package/components/assets/images/error.png +0 -0
  230. package/components/context/base.tsx +0 -28
  231. package/components/context/global/context.tsx +0 -39
  232. package/components/context/global/reducer.tsx +0 -56
  233. package/components/context/module/context.tsx +0 -23
  234. package/components/index.ts +0 -12
  235. package/config/antdReplacer.js +0 -51
  236. package/config/env.js +0 -104
  237. package/config/getHttpsConfig.js +0 -66
  238. package/config/jest/cssTransform.js +0 -14
  239. package/config/jest/fileTransform.js +0 -40
  240. package/config/modules.js +0 -134
  241. package/config/paths.js +0 -71
  242. package/config/pnpTs.js +0 -35
  243. package/config/webpack.config.js +0 -835
  244. package/config/webpackDevServer.config.js +0 -130
  245. package/examples.tsx +0 -87
  246. package/index.js +0 -1
  247. package/logo.svg +0 -7
  248. package/public/favicon.ico +0 -0
  249. package/public/index.html +0 -43
  250. package/public/logo192.png +0 -0
  251. package/public/logo512.png +0 -0
  252. package/public/manifest.json +0 -25
  253. package/public/robots.txt +0 -3
  254. package/react-app-env.d.ts +0 -71
  255. package/reportWebVitals.ts +0 -15
  256. package/scripts/build.js +0 -208
  257. package/scripts/lib.js +0 -200
  258. package/scripts/publish.js +0 -57
  259. package/scripts/start.js +0 -162
  260. package/scripts/test.js +0 -49
  261. package/setupTests.ts +0 -5
  262. package/tsconfig.json +0 -30
@@ -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 '../../../_utils/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 '../../../_utils/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.provider, {
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.name}
258
- </Button>
259
- ) : (
260
- <Tooltip
261
- key={item.provider}
262
- title={item.tooltip?.[i18n.language as Lang] || item.name}
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'