@authing/react-ui-components 3.0.2-beta.5 → 3.1.1-rc.1

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 (249) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/LICENSE +21 -0
  3. package/config/env.js +26 -24
  4. package/config/paths.js +3 -3
  5. package/config/webpack.config.js +29 -7
  6. package/lib/index.d.ts +211 -1252
  7. package/lib/index.min.css +1 -2
  8. package/lib/index.min.js +1 -1
  9. package/lib/index.min.js.LICENSE.txt +0 -32
  10. package/package.json +14 -20
  11. package/scripts/build.js +83 -79
  12. package/scripts/start.js +73 -69
  13. package/scripts/test.js +23 -19
  14. package/{components → src/common}/AuthingDropdown/index.tsx +1 -1
  15. package/{components → src/common}/AuthingDropdown/style.less +0 -0
  16. package/{components → src/common}/AuthingTabs/index.tsx +1 -1
  17. package/{components → src/common}/AuthingTabs/style.less +0 -0
  18. package/{components → src/common}/CopyAbleText/index.tsx +1 -1
  19. package/{components → src/common}/CopyAbleText/style.less +0 -0
  20. package/{components → src/common}/VerifyCodeInput/index.tsx +0 -0
  21. package/{components → src/common}/VerifyCodeInput/style.less +0 -0
  22. package/{components → src/components}/AuthingGuard/AppMFALayout/index.tsx +2 -2
  23. package/{components → src/components}/AuthingGuard/AppMFALayout/style.less +0 -0
  24. package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/index.tsx +1 -1
  25. package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/style.less +0 -0
  26. package/{components → src/components}/AuthingGuard/Forms/ADLoginForm/index.tsx +2 -2
  27. package/{components → src/components}/AuthingGuard/Forms/Agreements/index.tsx +1 -1
  28. package/{components → src/components}/AuthingGuard/Forms/Agreements/style.less +0 -0
  29. package/{components → src/components}/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +3 -3
  30. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +4 -2
  31. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +2 -2
  32. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +1 -1
  33. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  34. package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/index.tsx +2 -2
  35. package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  36. package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/index.tsx +4 -9
  37. package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  38. package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/index.tsx +1 -1
  39. package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/style.less +0 -0
  40. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +2 -2
  41. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +1 -1
  42. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +1 -1
  43. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -0
  44. package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/index.tsx +2 -2
  45. package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -0
  46. package/{components → src/components}/AuthingGuard/Forms/PasswordLoginForm/index.tsx +3 -3
  47. package/{components → src/components}/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +2 -2
  48. package/{components → src/components}/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +2 -2
  49. package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +4 -2
  50. package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -0
  51. package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/index.tsx +1 -1
  52. package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  53. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +1 -1
  54. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +2 -2
  55. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +2 -2
  56. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +2 -2
  57. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +1 -1
  58. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/index.tsx +1 -1
  59. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/style.less +0 -0
  60. package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -0
  61. package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/index.tsx +2 -2
  62. package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/style.less +0 -0
  63. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +2 -2
  64. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +2 -2
  65. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +1 -1
  66. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -0
  67. package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +7 -7
  68. package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -0
  69. package/{components → src/components}/AuthingGuard/Forms/UploadImage/index.tsx +1 -1
  70. package/{components → src/components}/AuthingGuard/Forms/index.ts +0 -0
  71. package/{components → src/components}/AuthingGuard/GuardLayout/index.tsx +17 -3
  72. package/{components → src/components}/AuthingGuard/GuardLayout/style.less +0 -0
  73. package/{components → src/components}/AuthingGuard/Header/index.tsx +6 -3
  74. package/{components → src/components}/AuthingGuard/Header/style.less +23 -11
  75. package/{components → src/components}/AuthingGuard/IconFont/iconfont.js +0 -0
  76. package/{components → src/components}/AuthingGuard/IconFont/index.tsx +1 -1
  77. package/{components → src/components}/AuthingGuard/IconFont/style.less +0 -0
  78. package/{components → src/components}/AuthingGuard/IconFont/svg.js +0 -0
  79. package/{components → src/components}/AuthingGuard/LoginLayout/index.tsx +69 -25
  80. package/{components → src/components}/AuthingGuard/LoginLayout/style.less +0 -0
  81. package/{components → src/components}/AuthingGuard/MfaLayout/Steps.ts +0 -0
  82. package/{components → src/components}/AuthingGuard/MfaLayout/index.tsx +1 -1
  83. package/{components → src/components}/AuthingGuard/MfaLayout/style.less +0 -0
  84. package/{components → src/components}/AuthingGuard/RegisterLayout/index.tsx +2 -2
  85. package/{components → src/components}/AuthingGuard/RegisterLayout/style.less +0 -0
  86. package/{components → src/components}/AuthingGuard/ResetPwdLayout/index.tsx +1 -1
  87. package/{components → src/components}/AuthingGuard/ToggleLang/index.tsx +2 -2
  88. package/{components → src/components}/AuthingGuard/api/appConfig.ts +22 -14
  89. package/{components/_utils → src/components/AuthingGuard/api}/http.ts +33 -30
  90. package/{components → src/components}/AuthingGuard/api/index.ts +0 -0
  91. package/{components → src/components}/AuthingGuard/api/sso.ts +1 -1
  92. package/{components → src/components}/AuthingGuard/api/userPoolConfig.ts +3 -2
  93. package/{components → src/components}/AuthingGuard/constants.ts +2 -2
  94. package/{components → src/components}/AuthingGuard/hooks/index.tsx +0 -0
  95. package/{components → src/components}/AuthingGuard/hooks/useScreenSize.tsx +0 -0
  96. package/{components → src/components}/AuthingGuard/index.tsx +11 -3
  97. package/{components/_utils → src/components/AuthingGuard}/locales/en/common.json +26 -70
  98. package/{components/_utils → src/components/AuthingGuard}/locales/en/index.ts +0 -0
  99. package/{components/_utils → src/components/AuthingGuard}/locales/en/login.json +19 -21
  100. package/{components/_utils → src/components/AuthingGuard}/locales/en/map.json +0 -0
  101. package/{components/_utils → src/components/AuthingGuard}/locales/en/user.json +3 -4
  102. package/{components/_utils → src/components/AuthingGuard}/locales/index.ts +2 -2
  103. package/{components/_utils → src/components/AuthingGuard}/locales/zh/common.json +9 -53
  104. package/{components/_utils → src/components/AuthingGuard}/locales/zh/index.ts +0 -0
  105. package/{components/_utils → src/components/AuthingGuard}/locales/zh/login.json +4 -6
  106. package/{components/_utils → src/components/AuthingGuard}/locales/zh/map.json +0 -0
  107. package/{components/_utils → src/components/AuthingGuard}/locales/zh/user.json +1 -3
  108. package/{components → src/components}/AuthingGuard/style.less +5 -0
  109. package/{components → src/components}/AuthingGuard/types/Forms.ts +2 -1
  110. package/{components → src/components}/AuthingGuard/types/GuardConfig.ts +5 -1
  111. package/{components → src/components}/AuthingGuard/types/GuardState.ts +1 -1
  112. package/{components → src/components}/AuthingGuard/types/Locales.ts +0 -0
  113. package/{components → src/components}/AuthingGuard/types/index.ts +0 -0
  114. package/src/components/index.ts +7 -0
  115. package/{components → src}/context/base.tsx +0 -0
  116. package/{components → src}/context/global/context.tsx +0 -0
  117. package/{components → src}/context/global/reducer.tsx +2 -2
  118. package/src/index.tsx +142 -0
  119. package/{logo.svg → src/logo.svg} +0 -0
  120. package/{react-app-env.d.ts → src/react-app-env.d.ts} +0 -0
  121. package/{reportWebVitals.ts → src/reportWebVitals.ts} +0 -0
  122. package/{setupTests.ts → src/setupTests.ts} +0 -0
  123. package/{components/_utils → src/utils}/clipboard.ts +1 -1
  124. package/{components/_utils → src/utils}/index.ts +3 -149
  125. package/{components/_utils → src/utils}/popupCenter.ts +0 -0
  126. package/tsconfig.json +2 -8
  127. package/build/asset-manifest.json +0 -26
  128. package/build/favicon.ico +0 -0
  129. package/build/index.html +0 -1
  130. package/build/logo192.png +0 -0
  131. package/build/logo512.png +0 -0
  132. package/build/manifest.json +0 -25
  133. package/build/robots.txt +0 -3
  134. package/build/static/css/2.51c07e65.chunk.css +0 -3
  135. package/build/static/css/2.51c07e65.chunk.css.map +0 -1
  136. package/build/static/css/main.779f221a.chunk.css +0 -2
  137. package/build/static/css/main.779f221a.chunk.css.map +0 -1
  138. package/build/static/js/2.bbae9fdb.chunk.js +0 -3
  139. package/build/static/js/2.bbae9fdb.chunk.js.LICENSE.txt +0 -102
  140. package/build/static/js/2.bbae9fdb.chunk.js.map +0 -1
  141. package/build/static/js/3.fd17f196.chunk.js +0 -2
  142. package/build/static/js/3.fd17f196.chunk.js.map +0 -1
  143. package/build/static/js/main.5f341531.chunk.js +0 -2
  144. package/build/static/js/main.5f341531.chunk.js.map +0 -1
  145. package/build/static/js/runtime-main.ef138021.js +0 -2
  146. package/build/static/js/runtime-main.ef138021.js.map +0 -1
  147. package/build/static/media/loading.4a67a5f3.svg +0 -29
  148. package/components/BindTotp/core/bindSuccess.tsx +0 -72
  149. package/components/BindTotp/core/securityCode.tsx +0 -108
  150. package/components/BindTotp/index.tsx +0 -134
  151. package/components/BindTotp/interface.ts +0 -30
  152. package/components/BindTotp/styles.less +0 -57
  153. package/components/ChangeLanguage/index.tsx +0 -35
  154. package/components/ChangePassword/core/firstLoginReset.tsx +0 -111
  155. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  156. package/components/ChangePassword/index.tsx +0 -72
  157. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  158. package/components/CompleteInfo/index.tsx +0 -45
  159. package/components/CompleteInfo/interface.ts +0 -40
  160. package/components/CompleteInfo/styles.less +0 -7
  161. package/components/DownloadAuthenticator/index.tsx +0 -97
  162. package/components/DownloadAuthenticator/interface.ts +0 -22
  163. package/components/DownloadAuthenticator/styles.less +0 -52
  164. package/components/Error/index.tsx +0 -21
  165. package/components/Error/interface.ts +0 -9
  166. package/components/Error/styles.less +0 -12
  167. package/components/ForgetPassword/core/resetPassword.tsx +0 -162
  168. package/components/ForgetPassword/index.tsx +0 -78
  169. package/components/ForgetPassword/interface.ts +0 -32
  170. package/components/Guard/Guard.tsx +0 -295
  171. package/components/Guard/authClient.ts +0 -44
  172. package/components/Guard/config.ts +0 -19
  173. package/components/Guard/event.ts +0 -52
  174. package/components/Guard/index.tsx +0 -4
  175. package/components/Guard/module.ts +0 -20
  176. package/components/Guard/stateMachine.ts +0 -152
  177. package/components/Guard/styles.less +0 -461
  178. package/components/IconFont/iconfont.js +0 -74
  179. package/components/IconFont/index.tsx +0 -16
  180. package/components/IconFont/style.less +0 -6
  181. package/components/IconFont/svg.js +0 -2
  182. package/components/ImagePro/index.tsx +0 -53
  183. package/components/ImagePro/styles.less +0 -40
  184. package/components/InputNumber/index.tsx +0 -33
  185. package/components/Login/codemap.ts +0 -49
  186. package/components/Login/core/withAD.tsx +0 -9
  187. package/components/Login/core/withAppQrcode.tsx +0 -49
  188. package/components/Login/core/withLDAP.tsx +0 -146
  189. package/components/Login/core/withPassword/FormItemAccount.tsx +0 -42
  190. package/components/Login/core/withPassword/GraphicVerifyCode.tsx +0 -30
  191. package/components/Login/core/withPassword/InputAccount.tsx +0 -64
  192. package/components/Login/core/withPassword/index.tsx +0 -173
  193. package/components/Login/core/withPhonecode.tsx +0 -122
  194. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  195. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  196. package/components/Login/index.tsx +0 -374
  197. package/components/Login/props.ts +0 -74
  198. package/components/Login/socialLogin/index.tsx +0 -407
  199. package/components/Login/socialLogin/style.less +0 -69
  200. package/components/Login/styles.less +0 -53
  201. package/components/MFA/VerifyCodeInput/VerifyCodeFormItem.tsx +0 -41
  202. package/components/MFA/VerifyCodeInput/index.tsx +0 -145
  203. package/components/MFA/VerifyCodeInput/style.less +0 -35
  204. package/components/MFA/codemap.ts +0 -24
  205. package/components/MFA/core/email.tsx +0 -203
  206. package/components/MFA/core/face.tsx +0 -297
  207. package/components/MFA/core/face_deps.tsx +0 -37
  208. package/components/MFA/core/sms.tsx +0 -203
  209. package/components/MFA/core/totp.tsx +0 -122
  210. package/components/MFA/index.tsx +0 -143
  211. package/components/MFA/mfaMethods/index.tsx +0 -88
  212. package/components/MFA/mfaMethods/style.less +0 -39
  213. package/components/MFA/props.ts +0 -51
  214. package/components/MFA/styles.less +0 -100
  215. package/components/NeedHelpView/core/describeQuestions.tsx +0 -245
  216. package/components/NeedHelpView/index.tsx +0 -47
  217. package/components/RecoveryCode/core/useCode.tsx +0 -71
  218. package/components/RecoveryCode/index.tsx +0 -27
  219. package/components/RecoveryCode/interface.ts +0 -31
  220. package/components/RecoveryCode/style.less +0 -13
  221. package/components/Register/codemap.ts +0 -12
  222. package/components/Register/components/Agreements/index.tsx +0 -81
  223. package/components/Register/components/Agreements/style.less +0 -44
  224. package/components/Register/core/WithEmail.tsx +0 -242
  225. package/components/Register/core/WithPhone.tsx +0 -184
  226. package/components/Register/index.tsx +0 -139
  227. package/components/Register/props.ts +0 -50
  228. package/components/SendCode/SendCodeBtn.tsx +0 -96
  229. package/components/SendCode/index.tsx +0 -94
  230. package/components/SendCode/style.less +0 -31
  231. package/components/ShieldSpin/index.tsx +0 -27
  232. package/components/ShieldSpin/loading.svg +0 -29
  233. package/components/SubmitButton/index.tsx +0 -50
  234. package/components/SubmitSuccess/index.tsx +0 -66
  235. package/components/SubmitSuccess/interface.ts +0 -17
  236. package/components/Type/index.ts +0 -52
  237. package/components/ValidatorRules/ValidatorFormItem.tsx +0 -139
  238. package/components/ValidatorRules/index.ts +0 -20
  239. package/components/_utils/GuardErrorCode.ts +0 -9
  240. package/components/_utils/config.ts +0 -116
  241. package/components/_utils/guradHttp.ts +0 -101
  242. package/components/_utils/hooks/index.ts +0 -64
  243. package/components/assets/images/error.png +0 -0
  244. package/components/context/module/context.tsx +0 -23
  245. package/components/index.ts +0 -12
  246. package/examples.tsx +0 -87
  247. package/index.js +0 -1
  248. package/lib/static/media/loading.4a67a5f3.svg +0 -29
  249. package/scripts/publish.js +0 -57
@@ -3,7 +3,7 @@ import { message, Spin, Upload } from 'antd'
3
3
  import { UploadChangeParam } from 'antd/lib/upload'
4
4
  import React, { FC, useState } from 'react'
5
5
  import { useTranslation } from 'react-i18next'
6
- import { useGuardContext } from '../../../context/global/context'
6
+ import { useGuardContext } from '../../../../context/global/context'
7
7
 
8
8
  export const UploadImage: FC<{
9
9
  value?: string
@@ -6,8 +6,8 @@ import {
6
6
  insertStyles,
7
7
  deepMerge,
8
8
  removeStyles,
9
- } from '../../_utils'
10
- import { useGuardContext } from '../../context/global/context'
9
+ } from '../../../utils'
10
+ import { useGuardContext } from '../../../context/global/context'
11
11
  import { GuardHeader } from '../../../components/AuthingGuard/Header'
12
12
  import { MfaLayout } from '../../../components/AuthingGuard/MfaLayout'
13
13
  import { LoginLayout } from '../../../components/AuthingGuard/LoginLayout'
@@ -39,7 +39,7 @@ import { IconFont } from '../IconFont'
39
39
  import { ToggleLang } from '../ToggleLang'
40
40
  import { useTranslation } from 'react-i18next'
41
41
  import i18n from 'i18next'
42
- import { changeLang } from '../../_utils/locales'
42
+ import { changeLang } from '../locales'
43
43
 
44
44
  const checkConfig = (appId: string) => {
45
45
  // 不要去掉 console.warn,不然 vue 版打包出来每次都会 throw error,估计是 rollup 打包有问题
@@ -156,6 +156,9 @@ const useGuardConfig = () => {
156
156
  appConfig.loginTabs?.list ||
157
157
  defaultGuardConfig.loginMethods
158
158
 
159
+ // 扫码多源配置
160
+ const qrcodeTabsSettings = appConfig.qrcodeTabsSettings ?? {}
161
+
159
162
  // 账密登录的登录拆分
160
163
  const passwordLoginMethods =
161
164
  userConfig.passwordLoginMethods ||
@@ -168,6 +171,8 @@ const useGuardConfig = () => {
168
171
  appConfig.loginTabs?.default ||
169
172
  defaultGuardConfig.defaultLoginMethod
170
173
 
174
+ const loginMethodTitleMapping = appConfig.loginTabs?.title
175
+
171
176
  // 注册方式
172
177
  const registerMethods =
173
178
  userConfig.registerMethods ||
@@ -184,6 +189,8 @@ const useGuardConfig = () => {
184
189
  ? ''
185
190
  : userConfig.title ?? appConfig.name ?? defaultGuardConfig.title
186
191
 
192
+ const description = loading ? '' : appConfig.description ?? ''
193
+
187
194
  // 应用 logo
188
195
  const logo = loading
189
196
  ? ''
@@ -218,6 +225,7 @@ const useGuardConfig = () => {
218
225
  {
219
226
  logo,
220
227
  title,
228
+ description,
221
229
  autoRegister,
222
230
  loginMethods,
223
231
  passwordLoginMethods,
@@ -230,18 +238,24 @@ const useGuardConfig = () => {
230
238
  defaultRegisterMethod,
231
239
  enterpriseConnectionObjs,
232
240
  publicKey: appConfig.publicKey,
241
+ qrcodeTabsSettings,
233
242
  agreementEnabled: appConfig.agreementEnabled,
234
243
  agreements: appConfig.agreements,
244
+ loginMethodTitleMapping: loginMethodTitleMapping,
235
245
  }
236
246
  )
237
247
  }, [
238
248
  userConfig,
239
249
  appConfig.loginTabs?.list,
250
+ appConfig.loginTabs?.defaultV2,
240
251
  appConfig.loginTabs?.default,
252
+ appConfig.loginTabs?.title,
253
+ appConfig.qrcodeTabsSettings,
241
254
  appConfig.passwordTabConfig?.enabledLoginMethods,
242
255
  appConfig.registerTabs?.list,
243
256
  appConfig.registerTabs?.default,
244
257
  appConfig.name,
258
+ appConfig.description,
245
259
  appConfig.logo,
246
260
  appConfig.ssoPageComponentDisplay?.autoRegisterThenLoginHintInfo,
247
261
  appConfig.ssoPageComponentDisplay?.registerBtn,
@@ -1,7 +1,7 @@
1
1
  import React, { FC } from 'react'
2
2
  import { Avatar } from 'antd'
3
3
 
4
- import { useGuardContext } from '../../context/global/context'
4
+ import { useGuardContext } from '../../../context/global/context'
5
5
 
6
6
  import './style.less'
7
7
 
@@ -10,7 +10,7 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
10
10
  export const GuardHeader: FC<HeaderProps> = (props) => {
11
11
  const {
12
12
  state: {
13
- config: { logo, title },
13
+ config: { logo, title, description },
14
14
  },
15
15
  } = useGuardContext()
16
16
 
@@ -19,7 +19,10 @@ export const GuardHeader: FC<HeaderProps> = (props) => {
19
19
  {Boolean(logo) && (
20
20
  <Avatar className="authing-guard-logo" src={logo} size={50}></Avatar>
21
21
  )}
22
- <div className="authing-guard-title">{title}</div>
22
+ <div className="authing-guard-title-container">
23
+ <div className="authing-guard-title">{title}</div>
24
+ <div className="authing-guard-description">{description}</div>
25
+ </div>
23
26
  </div>
24
27
  )
25
28
  }
@@ -13,23 +13,26 @@
13
13
  object-fit: contain;
14
14
  }
15
15
 
16
+ .authing-guard-title-container {
17
+ display: flex;
18
+ justify-content: center;
19
+ flex-direction: column;
20
+ align-items: center;
21
+ }
22
+
16
23
  .authing-guard-title {
17
- color: #abb9d7;
24
+ color: #282d3c;
18
25
  font-size: 24px;
19
- margin-bottom: 24px;
26
+ margin-bottom: 4px;
20
27
  width: 100%;
21
28
  word-break: break-all;
22
29
  text-align: center;
23
30
  }
24
-
25
- // .large .logo {
26
- // margin-bottom: 16px;
27
- // }
28
-
29
- // .large .title {
30
- // color: #333333;
31
- // font-size: 32px;
32
- // }
31
+ .authing-guard-description {
32
+ font-size: 16px;
33
+ color: #878a95;
34
+ margin-bottom: 23px;
35
+ }
33
36
 
34
37
  @media only screen and (max-width: 719px) {
35
38
  .authing-guard-header {
@@ -45,8 +48,17 @@
45
48
  padding-left: 8px;
46
49
  color: #333333;
47
50
  font-weight: 500;
51
+ text-align: unset;
48
52
  }
49
53
  .authing-guard-logo {
50
54
  margin: 0;
51
55
  }
56
+ .authing-guard-title-container {
57
+ flex-direction: column;
58
+ align-items: flex-start;
59
+ }
60
+ .authing-guard-description {
61
+ margin-bottom: 0px;
62
+ padding-left: 8px;
63
+ }
52
64
  }
@@ -1,5 +1,5 @@
1
1
  import React, { FC } from 'react'
2
- import { getClassnames } from '../../_utils'
2
+ import { getClassnames } from '../../../utils'
3
3
  import './iconfont'
4
4
  import './style.less'
5
5
 
@@ -1,9 +1,9 @@
1
1
  import { message } from 'antd'
2
2
  import { User } from 'authing-js-sdk'
3
3
  import { FormInstance } from 'antd/lib/form'
4
- import React, { useCallback, useRef } from 'react'
4
+ import React, { useCallback, useMemo, useRef } from 'react'
5
5
 
6
- import { useGuardContext } from '../../context/global/context'
6
+ import { useGuardContext } from '../../../context/global/context'
7
7
  import {
8
8
  ADLoginForm,
9
9
  LdapLoginForm,
@@ -17,7 +17,7 @@ import {
17
17
  APP_MFA_CODE,
18
18
  LOGIN_METHODS_MAP,
19
19
  } from '../../../components/AuthingGuard/constants'
20
- import { AuthingTabs } from '../../AuthingTabs'
20
+ import { AuthingTabs } from '../../../common/AuthingTabs'
21
21
  import {
22
22
  BaseFormProps,
23
23
  GuardScenes,
@@ -75,36 +75,36 @@ const useNormalLoginTabs = ({ onSuccess, onFail }: BaseFormProps) => {
75
75
  }
76
76
 
77
77
  const LOGIN_FORM_MAP = {
78
- [LoginMethods.Password]: (
78
+ [LoginMethods.Password]: (props: any) => (
79
79
  <PasswordLoginForm
80
- {...formProps}
80
+ {...props}
81
81
  ref={(v) => (formRef.current[LoginMethods.Password] = v!)}
82
82
  />
83
83
  ),
84
- [LoginMethods.PhoneCode]: (
84
+ [LoginMethods.PhoneCode]: (props: any) => (
85
85
  <PhoneCodeLoginForm
86
- {...formProps}
86
+ {...props}
87
87
  ref={(v) => (formRef.current[LoginMethods.PhoneCode] = v!)}
88
88
  />
89
89
  ),
90
- [LoginMethods.AppQr]: (
91
- <QrCodeLoginForm type={LoginMethods.AppQr} {...formProps} />
90
+ [LoginMethods.AppQr]: (props: any) => (
91
+ <QrCodeLoginForm type={LoginMethods.AppQr} {...props} />
92
92
  ),
93
- [LoginMethods.WxMinQr]: (
94
- <QrCodeLoginForm type={LoginMethods.WxMinQr} {...formProps} />
93
+ [LoginMethods.WxMinQr]: (props: any) => (
94
+ <QrCodeLoginForm type={LoginMethods.WxMinQr} {...props} />
95
95
  ),
96
- [LoginMethods.LDAP]: (
96
+ [LoginMethods.LDAP]: (props: any) => (
97
97
  <LdapLoginForm
98
- {...formProps}
98
+ {...props}
99
99
  ref={(v) => (formRef.current[LoginMethods.LDAP] = v!)}
100
100
  />
101
101
  ),
102
- [LoginMethods.WechatMpQrcode]: (
103
- <QrCodeLoginForm type={LoginMethods.WechatMpQrcode} {...formProps} />
102
+ [LoginMethods.WechatMpQrcode]: (props: any) => (
103
+ <QrCodeLoginForm type={LoginMethods.WechatMpQrcode} {...props} />
104
104
  ),
105
- [LoginMethods.AD]: (
105
+ [LoginMethods.AD]: (props: any) => (
106
106
  <ADLoginForm
107
- {...formProps}
107
+ {...props}
108
108
  ref={(v) => (formRef.current[LoginMethods.AD] = v!)}
109
109
  />
110
110
  ),
@@ -113,14 +113,46 @@ const useNormalLoginTabs = ({ onSuccess, onFail }: BaseFormProps) => {
113
113
  const {
114
114
  state: { config },
115
115
  } = useGuardContext()
116
- const { loginMethods = [] } = config
116
+ const {
117
+ loginMethods = [],
118
+ loginMethodTitleMapping,
119
+ qrcodeTabsSettings,
120
+ } = config
117
121
 
118
- const tabs = loginMethods.map((item) => ({
119
- key: item,
120
- label: LOGIN_METHODS_MAP()?.[item]!,
121
- component: LOGIN_FORM_MAP[item],
122
- }))
122
+ let tabs: any[] = []
123
123
 
124
+ // 兼容 密码登陆 donglyc
125
+ let filterLoginMethods = loginMethods.filter(
126
+ (d) => d.indexOf('password') === -1
127
+ )
128
+ const hasPassword = loginMethods.some((d) => d.indexOf('password') !== -1)
129
+ if (hasPassword) filterLoginMethods.push(LoginMethods.Password)
130
+
131
+ filterLoginMethods.forEach((method: LoginMethods) => {
132
+ if (
133
+ [LoginMethods.WechatMpQrcode, LoginMethods.WxMinQr].includes(method) &&
134
+ qrcodeTabsSettings[method]
135
+ ) {
136
+ tabs.push(
137
+ ...qrcodeTabsSettings[method].map((idp) => {
138
+ return {
139
+ key: idp.id,
140
+ label: idp.title || loginMethodTitleMapping[method],
141
+ component: LOGIN_FORM_MAP[method]({
142
+ ...formProps,
143
+ idp,
144
+ }),
145
+ }
146
+ })
147
+ )
148
+ } else {
149
+ tabs.push({
150
+ key: method,
151
+ label: LOGIN_METHODS_MAP()[method],
152
+ component: LOGIN_FORM_MAP[method](formProps),
153
+ })
154
+ }
155
+ })
124
156
  return {
125
157
  tabs,
126
158
  }
@@ -133,13 +165,25 @@ const SHOW_SOCIAL_LOGIN_TAB = [
133
165
  ]
134
166
  export const LoginLayout = () => {
135
167
  const {
136
- state: { activeTabs },
168
+ state: { activeTabs, config },
137
169
  setValue,
138
170
  } = useGuardContext()
171
+ const { qrcodeTabsSettings } = config
139
172
 
140
173
  const { onFail, onSuccess } = useFormActions()
141
174
  const { tabs } = useNormalLoginTabs({ onSuccess, onFail })
142
175
 
176
+ const activeKey = useMemo(() => {
177
+ const activeTab = activeTabs[GuardScenes.Login]
178
+ if (
179
+ [LoginMethods.WechatMpQrcode, LoginMethods.WxMinQr].includes(activeTab) &&
180
+ qrcodeTabsSettings[activeTab]
181
+ ) {
182
+ return qrcodeTabsSettings[activeTab].find((item) => item.isDefault)?.id
183
+ }
184
+ return activeTab
185
+ }, [activeTabs, qrcodeTabsSettings])
186
+
143
187
  return (
144
188
  <>
145
189
  <AuthingTabs
@@ -150,7 +194,7 @@ export const LoginLayout = () => {
150
194
  [GuardScenes.Login]: t,
151
195
  })
152
196
  }
153
- activeKey={activeTabs[GuardScenes.Login]}
197
+ activeKey={activeKey}
154
198
  />
155
199
 
156
200
  {SHOW_SOCIAL_LOGIN_TAB.includes(activeTabs[GuardScenes.Login]) && (
@@ -7,7 +7,7 @@ import {
7
7
  MfaResetCodeForm,
8
8
  MFAVerifyForm,
9
9
  } from '../../../components/AuthingGuard/Forms'
10
- import { useGuardContext } from '../../context/global/context'
10
+ import { useGuardContext } from '../../../context/global/context'
11
11
 
12
12
  import './style.less'
13
13
  import { useTranslation } from 'react-i18next'
@@ -2,13 +2,13 @@ import { message } from 'antd'
2
2
  import { User } from 'authing-js-sdk'
3
3
  import React, { FC } from 'react'
4
4
 
5
- import { useGuardContext } from '../../context/global/context'
5
+ import { useGuardContext } from '../../../context/global/context'
6
6
  import {
7
7
  GuardScenes,
8
8
  LoginMethods,
9
9
  RegisterMethods,
10
10
  } from '../../../components/AuthingGuard/types'
11
- import { AuthingTabs } from '../../AuthingTabs'
11
+ import { AuthingTabs } from '../../../common/AuthingTabs'
12
12
  import { REGISTER_METHODS_MAP } from '../../../components/AuthingGuard/constants'
13
13
  import {
14
14
  EmailRegisterForm,
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
 
3
- import { useGuardContext } from '../../context/global/context'
3
+ import { useGuardContext } from '../../../context/global/context'
4
4
  import { ResetPasswordForm } from '../../../components/AuthingGuard/Forms'
5
5
 
6
6
  export const ResetPwdLayout = () => {
@@ -2,8 +2,8 @@ import React, { FC } from 'react'
2
2
  import { Dropdown, Menu, Space } from 'antd'
3
3
  import { LANG_MAP } from '../types'
4
4
  import { useTranslation } from 'react-i18next'
5
- import { changeLang } from '../../_utils/locales'
6
- import { useGuardContext } from '../../context/global/context'
5
+ import { changeLang } from '../locales'
6
+ import { useGuardContext } from '../../../context/global/context'
7
7
  import { IconFont } from '../IconFont'
8
8
 
9
9
  export const ToggleLang: FC = () => {
@@ -1,15 +1,17 @@
1
- import { Lang, Protocol } from '../types'
1
+ import { requestClient } from './http'
2
+ import {
3
+ Lang,
4
+ LoginMethods,
5
+ Protocol,
6
+ } from '../../../components/AuthingGuard/types'
2
7
  import {
3
8
  IAzureAdConnectionConfig,
4
9
  ICasConnectionConfig,
5
- IOAuthConnectionConfig,
6
10
  ISamlConnectionConfig,
7
11
  OIDCConnectionConfig,
8
12
  SocialConnectionItem,
9
13
  } from './userPoolConfig'
10
- import { i18n } from '../../_utils/locales'
11
- import { requestClient } from '../../_utils/http'
12
- import { PasswordStrength } from '../../_utils'
14
+ import { i18n } from '../locales'
13
15
 
14
16
  export enum ApplicationMfaType {
15
17
  SMS = 'SMS',
@@ -27,6 +29,15 @@ export const ApplicationMfaTypeLabel: () => Record<
27
29
  [ApplicationMfaType.EMAIL]: i18n.t('common.EmailVerification'),
28
30
  })
29
31
 
32
+ export type QrcodeTabsSettings = Record<
33
+ LoginMethods,
34
+ Array<{
35
+ id: string
36
+ title: string
37
+ isDefault?: boolean
38
+ }>
39
+ >
40
+
30
41
  export interface OidcClientMetadata {
31
42
  grant_types: string[]
32
43
  client_id: string
@@ -77,6 +88,7 @@ export interface ApplicationConfig {
77
88
  css: string
78
89
  name: string
79
90
  logo: string
91
+ description?: string
80
92
  redirectUris: string[]
81
93
  registerDisabled: boolean
82
94
  registerTabs: {
@@ -84,9 +96,13 @@ export interface ApplicationConfig {
84
96
  default: string
85
97
  title: { [x: string]: string }
86
98
  }
99
+
100
+ qrcodeTabsSettings: QrcodeTabsSettings
101
+
87
102
  loginTabs: {
88
103
  list: string[]
89
104
  default: string
105
+ defaultV2?: string
90
106
  title: { [x: string]: string }
91
107
  }
92
108
  socialConnections: SocialConnectionItem[]
@@ -94,7 +110,6 @@ export interface ApplicationConfig {
94
110
  extendsFieldsEnabled: boolean
95
111
  extendsFields: ExtendsField[]
96
112
 
97
- identifier: string
98
113
  identityProviders: {
99
114
  identifier: string
100
115
  protocol: Protocol
@@ -105,7 +120,6 @@ export interface ApplicationConfig {
105
120
  | OIDCConnectionConfig
106
121
  | ICasConnectionConfig
107
122
  | IAzureAdConnectionConfig
108
- | IOAuthConnectionConfig
109
123
  }[]
110
124
 
111
125
  ssoPageComponentDisplay: {
@@ -132,15 +146,9 @@ export interface ApplicationConfig {
132
146
 
133
147
  agreementEnabled: boolean
134
148
  agreements: Agreement[]
135
- customPasswordStrength: any
136
- passwordStrength: PasswordStrength
137
- verifyCodeLength: number
138
149
  }
139
150
 
140
151
  export const fetchAppConfig = (appId: string) =>
141
152
  requestClient.get<ApplicationConfig>(
142
- `/api/v2/applications/${appId}/public-config`,
143
- {
144
- credentials: 'include',
145
- }
153
+ `/api/v2/applications/${appId}/public-config`
146
154
  )
@@ -1,5 +1,5 @@
1
1
  import qs from 'qs'
2
- import { i18n } from './locales'
2
+ import { i18n } from '../locales'
3
3
 
4
4
  export const requestClient = async (...rest: Parameters<typeof fetch>) => {
5
5
  const res = await fetch(...rest)
@@ -17,6 +17,15 @@ requestClient.get = async <T>(
17
17
  query: Record<string, any> = {},
18
18
  init?: RequestInit
19
19
  ): Promise<AuthingResponse<T>> => {
20
+ const headers: Record<string, any> = {
21
+ ...init?.headers,
22
+ 'Content-Type': 'application/json',
23
+ [requestClient.langHeader]: i18n.language,
24
+ }
25
+
26
+ if (requestClient.tenantId !== '')
27
+ headers[requestClient.tenantHeader] = requestClient.tenantId
28
+
20
29
  const res = await fetch(
21
30
  `${requestClient.baseUrl}${path}${qs.stringify(query, {
22
31
  addQueryPrefix: true,
@@ -24,10 +33,7 @@ requestClient.get = async <T>(
24
33
  {
25
34
  ...init,
26
35
  credentials: 'include',
27
- headers: {
28
- ...init?.headers,
29
- [requestClient.langHeader]: i18n.language,
30
- },
36
+ headers,
31
37
  }
32
38
  )
33
39
 
@@ -41,34 +47,20 @@ requestClient.post = async <T>(
41
47
  headers: any
42
48
  }
43
49
  ): Promise<AuthingResponse<T>> => {
50
+ const headers: Record<string, any> = {
51
+ ...config?.headers,
52
+ 'Content-Type': 'application/json',
53
+ [requestClient.langHeader]: i18n.language,
54
+ }
55
+
56
+ if (requestClient.tenantId !== '')
57
+ headers[requestClient.tenantHeader] = requestClient.tenantId
58
+
44
59
  const res = await fetch(`${requestClient.baseUrl}${path}`, {
45
60
  method: 'POST',
46
61
  body: JSON.stringify(data),
47
62
  credentials: 'include',
48
- headers: {
49
- 'Content-Type': 'application/json',
50
- ...config?.headers,
51
- [requestClient.langHeader]: i18n.language,
52
- },
53
- })
54
- return res.json()
55
- }
56
-
57
- requestClient.postForm = async <T>(
58
- path: string,
59
- formData: any,
60
- config?: {
61
- headers: any
62
- }
63
- ): Promise<AuthingResponse<T>> => {
64
- const res = await fetch(`${requestClient.baseUrl}${path}`, {
65
- method: 'post',
66
- body: formData,
67
- credentials: 'include',
68
- headers: {
69
- ...config?.headers,
70
- [requestClient.langHeader]: i18n.language,
71
- },
63
+ headers: headers,
72
64
  })
73
65
  return res.json()
74
66
  }
@@ -77,9 +69,20 @@ requestClient.baseUrl = ''
77
69
  requestClient.setBaseUrl = (base: string) => {
78
70
  requestClient.baseUrl = base.replace(/\/$/, '')
79
71
  }
80
-
81
72
  const DEFAULT_LANG_HEADER = 'x-authing-lang'
73
+ const DEFAULT_TENANT_HEADER = 'x-authing-app-tenant-idåå'
82
74
  requestClient.langHeader = DEFAULT_LANG_HEADER
75
+ requestClient.tenantHeader = DEFAULT_TENANT_HEADER
76
+ requestClient.tenantId = ''
77
+
83
78
  requestClient.setLangHeader = (key: string | undefined) => {
84
79
  requestClient.langHeader = key || DEFAULT_LANG_HEADER
85
80
  }
81
+
82
+ requestClient.setTenantHeader = (key: string | undefined) => {
83
+ requestClient.tenantHeader = key || DEFAULT_LANG_HEADER
84
+ }
85
+
86
+ requestClient.setTenantId = (tenantId: string) => {
87
+ requestClient.tenantId = tenantId
88
+ }
@@ -1,5 +1,5 @@
1
1
  import { User } from '../types'
2
- import { requestClient } from '../../_utils/http'
2
+ import { requestClient } from './http'
3
3
 
4
4
  export interface SessionData {
5
5
  session: null | {
@@ -1,4 +1,4 @@
1
- import { Lang, Protocol } from '../types'
1
+ import { Lang, Protocol } from '../../../components/AuthingGuard/types'
2
2
  import { SocialConnectionProvider } from 'authing-js-sdk'
3
3
 
4
4
  export interface OIDCConnectionConfig {
@@ -72,9 +72,10 @@ export interface ICasConnectionConfig {
72
72
  }
73
73
  export interface SocialConnectionItem {
74
74
  name: string
75
- name_en: string
75
+ displayName: string
76
76
  logo: string
77
77
  description: string
78
+ identifier: string
78
79
  provider: SocialConnectionProvider
79
80
  authorizationUrl: string
80
81
  tooltip: Record<Lang, string>
@@ -6,7 +6,7 @@ import {
6
6
  RegisterMethods,
7
7
  LocalesConfig,
8
8
  } from '../../components/AuthingGuard/types'
9
- import { i18n } from '../_utils/locales'
9
+ import { i18n } from './locales'
10
10
 
11
11
  // 个人版 OTP MFA 的 error code
12
12
  export const OTP_MFA_CODE = 1635
@@ -93,9 +93,9 @@ export const defaultLocalesConfig: LocalesConfig = {
93
93
  export const defaultHeaders: {
94
94
  'userpool-id': string
95
95
  'app-id': string
96
- 'tenant-id': string
97
96
  'sdk-version': string
98
97
  'request-from': string
98
+ 'tenant-id': string
99
99
  lang: string
100
100
  } = {
101
101
  'userpool-id': 'x-authing-userpool-id',