@authing/react-ui-components 3.0.0-alpha → 3.0.0-rc.11

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 (235) hide show
  1. package/dist/index.min.css +2 -0
  2. package/dist/index.min.js +2 -0
  3. package/dist/index.min.js.LICENSE.txt +71 -0
  4. package/{components/ShieldSpin/loading.svg → dist/static/media/loading.4a67a5f3.svg} +0 -0
  5. package/lib/index.d.ts +2108 -118
  6. package/lib/index.min.css +2 -2
  7. package/lib/index.min.js +1 -1
  8. package/lib/index.min.js.LICENSE.txt +2 -0
  9. package/package.json +32 -10
  10. package/.eslintignore +0 -6
  11. package/.eslintrc.js +0 -7
  12. package/.prettierrc +0 -5
  13. package/.vscode/settings.json +0 -31
  14. package/build/favicon.ico +0 -0
  15. package/build/logo192.png +0 -0
  16. package/build/logo512.png +0 -0
  17. package/build/manifest.json +0 -25
  18. package/build/robots.txt +0 -3
  19. package/components/AuthingDropdown/index.tsx +0 -52
  20. package/components/AuthingDropdown/style.less +0 -43
  21. package/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  22. package/components/AuthingGuard/AppMFALayout/style.less +0 -12
  23. package/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  24. package/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  25. package/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  26. package/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  27. package/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  28. package/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  29. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -84
  30. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  31. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  32. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  33. package/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  34. package/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  35. package/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -166
  36. package/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  37. package/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  38. package/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  39. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  40. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  41. package/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  42. package/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  43. package/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  44. package/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  45. package/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  46. package/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  47. package/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  48. package/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -59
  49. package/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  50. package/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  51. package/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  52. package/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  53. package/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  54. package/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  55. package/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  56. package/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  57. package/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  58. package/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  59. package/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  60. package/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  61. package/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  62. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  63. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  64. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  65. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  66. package/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  67. package/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  68. package/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  69. package/components/AuthingGuard/Forms/index.ts +0 -13
  70. package/components/AuthingGuard/GuardLayout/index.tsx +0 -474
  71. package/components/AuthingGuard/GuardLayout/style.less +0 -111
  72. package/components/AuthingGuard/Header/index.tsx +0 -25
  73. package/components/AuthingGuard/Header/style.less +0 -52
  74. package/components/AuthingGuard/IconFont/iconfont.js +0 -74
  75. package/components/AuthingGuard/IconFont/index.tsx +0 -19
  76. package/components/AuthingGuard/IconFont/style.less +0 -6
  77. package/components/AuthingGuard/IconFont/svg.js +0 -2
  78. package/components/AuthingGuard/LoginLayout/index.tsx +0 -161
  79. package/components/AuthingGuard/LoginLayout/style.less +0 -0
  80. package/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  81. package/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  82. package/components/AuthingGuard/MfaLayout/style.less +0 -3
  83. package/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  84. package/components/AuthingGuard/RegisterLayout/style.less +0 -0
  85. package/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  86. package/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  87. package/components/AuthingGuard/api/appConfig.ts +0 -146
  88. package/components/AuthingGuard/api/index.ts +0 -3
  89. package/components/AuthingGuard/api/sso.ts +0 -29
  90. package/components/AuthingGuard/api/userPoolConfig.ts +0 -111
  91. package/components/AuthingGuard/constants.ts +0 -105
  92. package/components/AuthingGuard/hooks/index.tsx +0 -70
  93. package/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  94. package/components/AuthingGuard/index.tsx +0 -126
  95. package/components/AuthingGuard/style.less +0 -103
  96. package/components/AuthingGuard/types/Forms.ts +0 -94
  97. package/components/AuthingGuard/types/GuardConfig.ts +0 -420
  98. package/components/AuthingGuard/types/GuardState.ts +0 -7
  99. package/components/AuthingGuard/types/Locales.ts +0 -12
  100. package/components/AuthingGuard/types/index.ts +0 -4
  101. package/components/AuthingTabs/index.tsx +0 -98
  102. package/components/AuthingTabs/style.less +0 -135
  103. package/components/BindTotp/core/bindSuccess.tsx +0 -61
  104. package/components/BindTotp/core/securityCode.tsx +0 -119
  105. package/components/BindTotp/index.tsx +0 -134
  106. package/components/BindTotp/props.ts +0 -30
  107. package/components/BindTotp/styles.less +0 -56
  108. package/components/ChangeLanguage/index.tsx +0 -35
  109. package/components/ChangePassword/core/firstLoginReset.tsx +0 -104
  110. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  111. package/components/ChangePassword/index.tsx +0 -59
  112. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  113. package/components/CompleteInfo/index.tsx +0 -45
  114. package/components/CompleteInfo/props.ts +0 -40
  115. package/components/CompleteInfo/styles.less +0 -7
  116. package/components/CompleteUserInfo/index.tsx +0 -49
  117. package/components/CompleteUserInfo/props.ts +0 -25
  118. package/components/ComponentsRender/index.back +0 -64
  119. package/components/CopyAbleText/index.tsx +0 -54
  120. package/components/CopyAbleText/style.less +0 -13
  121. package/components/DownloadAuthenticator/index.tsx +0 -97
  122. package/components/DownloadAuthenticator/props.ts +0 -22
  123. package/components/DownloadAuthenticator/styles.less +0 -52
  124. package/components/ForgetPassword/core/resetPassword.tsx +0 -150
  125. package/components/ForgetPassword/index.tsx +0 -51
  126. package/components/Guard/Guard.tsx +0 -226
  127. package/components/Guard/authClient.ts +0 -55
  128. package/components/Guard/config.ts +0 -19
  129. package/components/Guard/event.ts +0 -18
  130. package/components/Guard/index.tsx +0 -10
  131. package/components/Guard/module.ts +0 -19
  132. package/components/Guard/stateMachine.ts +0 -133
  133. package/components/Guard/styles.less +0 -444
  134. package/components/IconFont/iconfont.js +0 -74
  135. package/components/IconFont/index.tsx +0 -16
  136. package/components/IconFont/style.less +0 -6
  137. package/components/IconFont/svg.js +0 -2
  138. package/components/ImagePro/index.tsx +0 -52
  139. package/components/ImagePro/styles.less +0 -40
  140. package/components/Login/codemap.ts +0 -35
  141. package/components/Login/core/withAD.tsx +0 -9
  142. package/components/Login/core/withAppQrcode.tsx +0 -49
  143. package/components/Login/core/withLDAP.tsx +0 -145
  144. package/components/Login/core/withPassword.tsx +0 -176
  145. package/components/Login/core/withPhonecode.tsx +0 -135
  146. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  147. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  148. package/components/Login/index.tsx +0 -359
  149. package/components/Login/props.ts +0 -90
  150. package/components/Login/socialLogin/index.tsx +0 -413
  151. package/components/Login/socialLogin/style.less +0 -61
  152. package/components/Login/styles.less +0 -53
  153. package/components/MFA/codemap.ts +0 -21
  154. package/components/MFA/core/email.tsx +0 -226
  155. package/components/MFA/core/face.tsx +0 -297
  156. package/components/MFA/core/face_deps.tsx +0 -37
  157. package/components/MFA/core/sms.tsx +0 -222
  158. package/components/MFA/core/totp.tsx +0 -137
  159. package/components/MFA/index.tsx +0 -135
  160. package/components/MFA/mfaMethods/index.tsx +0 -81
  161. package/components/MFA/mfaMethods/style.less +0 -39
  162. package/components/MFA/props.ts +0 -51
  163. package/components/MFA/styles.less +0 -92
  164. package/components/NeedHelpView/core/describeQuestions.tsx +0 -227
  165. package/components/NeedHelpView/index.tsx +0 -99
  166. package/components/RecoveryCode/core/useCode.tsx +0 -71
  167. package/components/RecoveryCode/index.tsx +0 -27
  168. package/components/RecoveryCode/interface.ts +0 -31
  169. package/components/RecoveryCode/style.less +0 -13
  170. package/components/Register/codemap.ts +0 -16
  171. package/components/Register/components/Agreements/index.tsx +0 -81
  172. package/components/Register/components/Agreements/style.less +0 -44
  173. package/components/Register/core/WithEmail.tsx +0 -250
  174. package/components/Register/core/WithPhone.tsx +0 -190
  175. package/components/Register/index.tsx +0 -122
  176. package/components/Register/props.ts +0 -50
  177. package/components/SendCode/SendCodeBtn.tsx +0 -96
  178. package/components/SendCode/index.tsx +0 -98
  179. package/components/SendCode/style.less +0 -31
  180. package/components/ShieldSpin/index.tsx +0 -27
  181. package/components/SubmitButton/index.tsx +0 -50
  182. package/components/Type/index.ts +0 -61
  183. package/components/VerifyCodeInput/index.tsx +0 -76
  184. package/components/VerifyCodeInput/style.less +0 -24
  185. package/components/_utils/GuardErrorCode.ts +0 -8
  186. package/components/_utils/clipboard.ts +0 -27
  187. package/components/_utils/config.ts +0 -123
  188. package/components/_utils/guradHttp.ts +0 -93
  189. package/components/_utils/hooks/index.ts +0 -56
  190. package/components/_utils/http.ts +0 -85
  191. package/components/_utils/index.ts +0 -310
  192. package/components/_utils/locales/en/common.json +0 -218
  193. package/components/_utils/locales/en/index.ts +0 -6
  194. package/components/_utils/locales/en/login.json +0 -95
  195. package/components/_utils/locales/en/map.json +0 -4
  196. package/components/_utils/locales/en/user.json +0 -82
  197. package/components/_utils/locales/index.ts +0 -45
  198. package/components/_utils/locales/zh/common.json +0 -218
  199. package/components/_utils/locales/zh/index.ts +0 -6
  200. package/components/_utils/locales/zh/login.json +0 -95
  201. package/components/_utils/locales/zh/map.json +0 -4
  202. package/components/_utils/locales/zh/user.json +0 -82
  203. package/components/_utils/popupCenter.ts +0 -48
  204. package/components/context/base.tsx +0 -28
  205. package/components/context/global/context.tsx +0 -39
  206. package/components/context/global/reducer.tsx +0 -56
  207. package/components/context/module/context.tsx +0 -23
  208. package/components/index.ts +0 -10
  209. package/config/antdReplacer.js +0 -51
  210. package/config/env.js +0 -104
  211. package/config/getHttpsConfig.js +0 -66
  212. package/config/jest/cssTransform.js +0 -14
  213. package/config/jest/fileTransform.js +0 -40
  214. package/config/modules.js +0 -134
  215. package/config/paths.js +0 -71
  216. package/config/pnpTs.js +0 -35
  217. package/config/webpack.config.js +0 -835
  218. package/config/webpackDevServer.config.js +0 -130
  219. package/examples.tsx +0 -100
  220. package/index.js +0 -1
  221. package/logo.svg +0 -7
  222. package/public/favicon.ico +0 -0
  223. package/public/index.html +0 -43
  224. package/public/logo192.png +0 -0
  225. package/public/logo512.png +0 -0
  226. package/public/manifest.json +0 -25
  227. package/public/robots.txt +0 -3
  228. package/react-app-env.d.ts +0 -71
  229. package/reportWebVitals.ts +0 -15
  230. package/scripts/build.js +0 -208
  231. package/scripts/lib.js +0 -200
  232. package/scripts/start.js +0 -162
  233. package/scripts/test.js +0 -49
  234. package/setupTests.ts +0 -5
  235. package/tsconfig.json +0 -30
@@ -1,85 +0,0 @@
1
- import qs from 'qs'
2
- import { i18n } from './locales'
3
-
4
- export const requestClient = async (...rest: Parameters<typeof fetch>) => {
5
- const res = await fetch(...rest)
6
- return res.json()
7
- }
8
-
9
- export interface AuthingResponse<T = any> {
10
- code: number
11
- message?: string
12
- data?: T
13
- }
14
-
15
- requestClient.get = async <T>(
16
- path: string,
17
- query: Record<string, any> = {},
18
- init?: RequestInit
19
- ): Promise<AuthingResponse<T>> => {
20
- const res = await fetch(
21
- `${requestClient.baseUrl}${path}${qs.stringify(query, {
22
- addQueryPrefix: true,
23
- })}`,
24
- {
25
- ...init,
26
- credentials: 'include',
27
- headers: {
28
- ...init?.headers,
29
- [requestClient.langHeader]: i18n.language,
30
- },
31
- }
32
- )
33
-
34
- return res.json()
35
- }
36
-
37
- requestClient.post = async <T>(
38
- path: string,
39
- data: any,
40
- config?: {
41
- headers: any
42
- }
43
- ): Promise<AuthingResponse<T>> => {
44
- const res = await fetch(`${requestClient.baseUrl}${path}`, {
45
- method: 'POST',
46
- body: JSON.stringify(data),
47
- 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
- },
72
- })
73
- return res.json()
74
- }
75
-
76
- requestClient.baseUrl = ''
77
- requestClient.setBaseUrl = (base: string) => {
78
- requestClient.baseUrl = base.replace(/\/$/, '')
79
- }
80
-
81
- const DEFAULT_LANG_HEADER = 'x-authing-lang'
82
- requestClient.langHeader = DEFAULT_LANG_HEADER
83
- requestClient.setLangHeader = (key: string | undefined) => {
84
- requestClient.langHeader = key || DEFAULT_LANG_HEADER
85
- }
@@ -1,310 +0,0 @@
1
- import { useEffect } from 'react'
2
- import { Rule } from 'antd/lib/form'
3
- import qs from 'qs'
4
- import { useGuardContext } from '../context/global/context'
5
- import { i18n } from './locales'
6
-
7
- export * from './popupCenter'
8
- export * from './clipboard'
9
-
10
- export const VALIDATE_PATTERN = {
11
- // https://emailregex.com/
12
- // eslint-disable-next-line no-control-regex
13
- email: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
14
- // 以下的来自 authing-user-portal 项目
15
- phone: /^1[3-9]\d{9}$/,
16
- ip: /^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}$/,
17
- host: /^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+.?$/,
18
- } as const
19
-
20
- export const validate = (type: keyof typeof VALIDATE_PATTERN, val: string) => {
21
- return VALIDATE_PATTERN[type].test(val)
22
- }
23
-
24
- export const getRequiredRules = (msg: string): Rule[] => {
25
- return [
26
- {
27
- required: true,
28
- message: msg,
29
- },
30
- ]
31
- }
32
-
33
- export function getDeviceName() {
34
- if (typeof window === 'undefined') {
35
- return null
36
- }
37
-
38
- const userAgent = window.navigator.userAgent
39
- const platform = window.navigator.platform
40
- const macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K']
41
- const windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE']
42
- const iosPlatforms = ['iPhone', 'iPad', 'iPod']
43
-
44
- let os = null
45
-
46
- if (macosPlatforms.indexOf(platform) !== -1) {
47
- os = 'Mac OS'
48
- } else if (iosPlatforms.indexOf(platform) !== -1) {
49
- os = 'iOS'
50
- } else if (windowsPlatforms.indexOf(platform) !== -1) {
51
- os = 'Windows'
52
- } else if (/Android/.test(userAgent)) {
53
- os = 'Android'
54
- } else if (!os && /Linux/.test(platform)) {
55
- os = 'Linux'
56
- }
57
-
58
- return os
59
- }
60
-
61
- export type STYLE_RECORD_KEY = 'appConfig' | 'userConfig'
62
-
63
- /**
64
- * 传对象 {'background-color': 'red'}
65
- * 传字符串 "CSS 样式"
66
- */
67
- const insertedRecord: Record<STYLE_RECORD_KEY, any> = {
68
- appConfig: null,
69
- userConfig: null,
70
- }
71
- export const insertStyles = (
72
- styles: string | any,
73
- recordKey: STYLE_RECORD_KEY
74
- ) => {
75
- let styleElt, styleSheet
76
- if ((document as any).createStyleSheet) {
77
- // IE
78
- styleSheet = (document as any).createStyleSheet()
79
- } else {
80
- let head = document.getElementsByTagName('head')[0]
81
- styleElt = document.createElement('style')
82
- head.appendChild(styleElt)
83
- styleSheet = document.styleSheets[document.styleSheets.length - 1]
84
- }
85
- if (typeof styles === 'string') {
86
- if (styleElt) styleElt.innerHTML = styles
87
- else styleSheet.cssText = styles // IE
88
- } else {
89
- let i = 0
90
- for (let selector in styles) {
91
- if (styleSheet.insertRule) {
92
- let rule = selector + ' {' + styles[selector] + '}'
93
- styleSheet.insertRule(rule, i++)
94
- } else {
95
- styleSheet.addRule(selector, styles[selector], i++)
96
- }
97
- }
98
- }
99
-
100
- insertedRecord[recordKey] = styleElt
101
- }
102
-
103
- export const removeStyles = (recordKey: STYLE_RECORD_KEY) => {
104
- if (!insertedRecord[recordKey]) {
105
- return
106
- }
107
-
108
- const styleElt = insertedRecord[recordKey]
109
-
110
- styleElt.parentNode?.removeChild(styleElt)
111
-
112
- insertedRecord[recordKey] = null
113
- }
114
-
115
- export const useTitle = (title: string, prefix?: string) => {
116
- const {
117
- state: { config },
118
- } = useGuardContext()
119
-
120
- useEffect(() => {
121
- document.title = `${prefix ?? `${config.title} `} ${title}`
122
- }, [config.title, prefix, title])
123
- }
124
-
125
- export const getClassnames = (classnames: (string | boolean | undefined)[]) => {
126
- return classnames.filter(Boolean).join(' ')
127
- }
128
-
129
- /**
130
- * https://www.itranslater.com/qa/details/2115518846294557696
131
- * Simple object check.
132
- * @param item
133
- * @returns {boolean}
134
- */
135
- export function isObject(item: any) {
136
- return item && typeof item === 'object' && !Array.isArray(item)
137
- }
138
-
139
- /**
140
- * https://www.itranslater.com/qa/details/2115518846294557696
141
- * Deep merge two objects.
142
- * @param target
143
- * @param ...sources
144
- */
145
- export function deepMerge<T extends any = any>(
146
- target: T,
147
- ...sources: any[]
148
- ): T {
149
- if (!sources.length) return target
150
- const source = sources.shift()
151
-
152
- if (isObject(target) && isObject(source)) {
153
- for (const key in source) {
154
- if (isObject(source[key])) {
155
- // @ts-ignore
156
- if (!target[key]) {
157
- Object.assign(target, { [key]: {} })
158
- }
159
- // @ts-ignore
160
- deepMerge(target[key], source[key])
161
- } else {
162
- Object.assign(target, { [key]: source[key] })
163
- }
164
- }
165
- }
166
-
167
- return deepMerge(target, ...sources)
168
- }
169
-
170
- export const getUserRegisterParams = () => {
171
- const query = qs.parse(window.location.search, {
172
- ignoreQueryPrefix: true,
173
- })
174
- return Object.keys(query).map((key) => ({
175
- key,
176
- value: query[key],
177
- }))
178
- }
179
-
180
- export const isWechatBrowser = () =>
181
- /MicroMessenger/i.test(navigator?.userAgent)
182
-
183
- export const assembledAppHost = (identifier: string, host: string) => {
184
- const hostUrl = new URL(host)
185
-
186
- const splitHost = hostUrl.hostname.split('.')
187
-
188
- splitHost.shift()
189
-
190
- return `${hostUrl.protocol}//${identifier}.${splitHost.join('.')}`
191
- }
192
-
193
- export enum PasswordStrength {
194
- NoCheck,
195
- Low,
196
- Middle,
197
- High,
198
- AUTO,
199
- }
200
-
201
- export const PASSWORD_STRENGTH_TEXT_MAP: Record<
202
- PasswordStrength,
203
- {
204
- placeholder: () => string
205
- validateMessage: () => string
206
- }
207
- > = {
208
- [PasswordStrength.NoCheck]: {
209
- placeholder: () => i18n.t('login.inputPwd'),
210
- validateMessage: () => i18n.t('login.inputPwd'),
211
- },
212
- [PasswordStrength.Low]: {
213
- placeholder: () => i18n.t('login.setPwdLimit1'),
214
- validateMessage: () => i18n.t('login.setPwdLimitMsg1'),
215
- },
216
- [PasswordStrength.Middle]: {
217
- placeholder: () => i18n.t('login.login.setPwdLimit2'),
218
- validateMessage: () => i18n.t('login.setPwdLimitMsg2'),
219
- },
220
- [PasswordStrength.High]: {
221
- placeholder: () => i18n.t('login.login.setPwdLimit3'),
222
- validateMessage: () => i18n.t('login.setPwdLimitMsg3'),
223
- },
224
- [PasswordStrength.AUTO]: {
225
- placeholder: () => i18n.t('login.inputPwd'),
226
- validateMessage: () => i18n.t('login.inputPwd'),
227
- },
228
- }
229
-
230
- const SYMBOL_TYPE_PATTERNS = [
231
- /\d+/,
232
- /[a-zA-Z]/,
233
- /[-!$%^&*()_+|~=`{}[\]:";'<>?,@./]/,
234
- ]
235
-
236
- export const getSymbolTypeLength = (pwd: string) => {
237
- return SYMBOL_TYPE_PATTERNS.map((pattern) => pattern.test(pwd)).filter(
238
- (item) => item
239
- ).length
240
- }
241
-
242
- export const getPasswordValidate = (
243
- strength: PasswordStrength = PasswordStrength.NoCheck,
244
- customPasswordStrength: any = {}
245
- ): Rule[] => {
246
- const required = {
247
- required: true,
248
- message: i18n.t('common.passwordNotNull'),
249
- }
250
-
251
- const validateMap: Record<PasswordStrength, Rule[]> = {
252
- [PasswordStrength.NoCheck]: [required],
253
- [PasswordStrength.Low]: [
254
- required,
255
- {
256
- validator(r, v) {
257
- if (v && v.length < 6) {
258
- return Promise.reject(
259
- PASSWORD_STRENGTH_TEXT_MAP[PasswordStrength.Low].validateMessage()
260
- )
261
- }
262
- return Promise.resolve()
263
- },
264
- },
265
- ],
266
- [PasswordStrength.Middle]: [
267
- required,
268
- {
269
- validator(r, v) {
270
- if (v && (v.length < 6 || getSymbolTypeLength(v) < 2)) {
271
- return Promise.reject(
272
- PASSWORD_STRENGTH_TEXT_MAP[
273
- PasswordStrength.Middle
274
- ].validateMessage()
275
- )
276
- }
277
- return Promise.resolve()
278
- },
279
- },
280
- ],
281
- [PasswordStrength.High]: [
282
- required,
283
- {
284
- validator(r, v) {
285
- console.log(r, v)
286
- if (v && (v.length < 6 || getSymbolTypeLength(v) < 3)) {
287
- console.log(
288
- PASSWORD_STRENGTH_TEXT_MAP[PasswordStrength.High].validateMessage
289
- )
290
- return Promise.reject(
291
- PASSWORD_STRENGTH_TEXT_MAP[
292
- PasswordStrength.High
293
- ].validateMessage()
294
- )
295
- }
296
- return Promise.resolve(true)
297
- },
298
- },
299
- ],
300
- [PasswordStrength.AUTO]: [
301
- required,
302
- {
303
- pattern: customPasswordStrength?.regex,
304
- message: customPasswordStrength?.message,
305
- },
306
- ],
307
- }
308
-
309
- return validateMap[strength]
310
- }
@@ -1,218 +0,0 @@
1
- {
2
- "addressLabel": "Location:",
3
- "administrator": "Administrator",
4
- "agreeAgreement": "I have read and accept ",
5
- "alreadyHasAcc": "Already have an account, ",
6
- "appNotFound": "The application does not exist, please check if the application link is correct",
7
- "appPanel": "Application panel",
8
- "authApp": "Authorized application",
9
- "authAppSomePermisson": "{{name}} apply to access your account information and authorize {{name}} the following permissions",
10
- "authingBackendSystem": "Authing background management system",
11
- "authoriztion": "Authorization",
12
- "baseInfo": "Basic Information",
13
- "bind": "Bind",
14
- "quesitons": "Help",
15
- "bindEmail": "Bind Email",
16
- "bindPhone": "Bind mobile phone number",
17
- "birthdayLabel": "Birthday:",
18
- "blogLabel": "Blog:",
19
- "cancel": "Cancel",
20
- "chooseRole": "Choose role",
21
- "companyLabel": "Company:",
22
- "confirm": "Confirm",
23
- "confirmLogout": "Are you sure to log out?",
24
- "currentEmail": "Current Email",
25
- "currentEmailVerifyCode": "Current Email Verification Code",
26
- "currentPhoneNumber": "Current Phone Number",
27
- "dashboard": "Console",
28
- "editPic": "Edit picture",
29
- "email": "Email",
30
- "emailFormatError": "E-mail format is incorrect",
31
- "emailLabel": "Email:",
32
- "enterprisePanel": "Enterprise Panel",
33
- "enterprisePanelInfo": "Your enterprise applications and personally configured applications will be displayed here. Click the application icon to login.",
34
- "female": "Female",
35
- "genderLabel": "Gender:",
36
- "guidance": {
37
- "loginApp": "Sign in to the app",
38
- "loginAppStep1": "Now to experience it.",
39
- "registerAcc": "Register an account",
40
- "registerAccStep1": "First of all, let's register a new account.",
41
- "registerAccStep2": "We have filled in the information for you, click register!"
42
- },
43
- "hasForgotPwd": "Forgot password?",
44
- "hasLooseSaftyCode": "Lost the security code?",
45
- "image": "Image",
46
- "inputFourVerifyCode": "Enter {{length}}-digit code",
47
- "inputNewPhone": "Enter a new phone number",
48
- "jumpAfterCount": "{{number}}s automatically redirect to login",
49
- "login": "Login",
50
- "loginImmediate": "Sign In Instead",
51
- "loginSuccessWelcome": "Successful login, welcome: {{name}}",
52
- "logout": "Logout",
53
- "logoutSuccess": "Exit successfully",
54
- "man": "Male",
55
- "modify": "Modify",
56
- "modifyEmail": "Modify Email",
57
- "modifyPhoneNumber": "Modify Mobile Phone Number",
58
- "nameLabel": "Name:",
59
- "newMailbox": "New Email",
60
- "newMailboxVerifyCode": "New Email Verification Code",
61
- "newPhone": "New Phone Number",
62
- "newPhoneVerify": "New Phone Verification Code",
63
- "nicknameLabel": "Display Name:",
64
- "noAccYet": "No account yet, ",
65
- "noOpenedApp": "No Available App",
66
- "oldPhoneVerfiyCode": "Old Phone Verification Code",
67
- "operateSuccess": "Successful operation",
68
- "perfectUserInfo": "Improve user information",
69
- "personalCenter": "Authing Account",
70
- "phoneFormateError": "Phone number format is incorrect",
71
- "phoneLabel": "Phone Number:",
72
- "phoneNumber": "Phone Number",
73
- "picExtError": "Picture format error",
74
- "picSizeLimit": "The picture cannot be larger than 5 megabytes",
75
- "pleaseInputCorrectMailbox": "Enter your vaild email",
76
- "pwdModifySuccess": "Password reset complete",
77
- "register": "Register",
78
- "registerDateLabel": "Registration date:",
79
- "registerImmediate": "sign up now",
80
- "registerInfoFill": "Registration information completion",
81
- "resetPwd": "Reset password",
82
- "retryAfterTime": "{{time}} seconds",
83
- "sendVerifyCode": "Send code",
84
- "submit": "Submit",
85
- "sure": "Confirm",
86
- "unknown": "Unknown",
87
- "updateSuccess": "Update Completed",
88
- "uploadFail": "{{name}} failed to upload",
89
- "useRecoverCode": "Use recovery code",
90
- "username": "Username",
91
- "usernameLabel": "Username:",
92
- "verifyCode": "Verification Code",
93
- "visitPersonalAccData": "Access your personal user data",
94
- "welcomeJoin": "Welcome to {{name}}",
95
- "welcomeJoinAndPerfect": "Welcome to join {{name}}, in order to have a better experience, please improve your information first",
96
- "start": "Start ",
97
- "problem": {
98
- "title": "How can we help you?",
99
- "noProblem": "No more questions,",
100
- "goLogin": " Log in",
101
- "verifyTip": "Contact information is required!",
102
- "noVerify": "Unable to receive the verification code",
103
- "noLogin": "Unable to log in",
104
- "noRegister": "Unable to register",
105
- "noAccount": "Lost Account",
106
- "noResetPass": "Unable to reset password",
107
- "locked": "Account is locked",
108
- "other": "Other",
109
- "noVerifyTip": {
110
- "tip": "If you don't receive the verification code, please do the following steps to solve this issue:",
111
- "type1": "1. Check if your mobile phone is turned off or offline.",
112
- "type2": "2. Check if your phone number has been entered correctly.",
113
- "type3": "3. Check if your SMS with the verification code is blocked."
114
- },
115
- "noLoginTip": {
116
- "tip": "If you don't receive the verification code, please do the following steps to solve this issue: ",
117
- "type1": "1. Check if your username and password have been entered correctly.",
118
- "type2": "2. Check if your mobile phone is turned off or offline."
119
- },
120
- "noRegisterTip": {
121
- "tip": "If you cannot register, please do the following steps to solve this issue:",
122
- "type1": "1. Check if your account has been registered.",
123
- "type2": "2. Check if your phone number has been entered correctly.",
124
- "type3": "3. Check if your SMS with the verification code is blocked."
125
- },
126
- "noAccountTip": {
127
- "tip": "If your account is lost, please do the following steps to solve this issue:",
128
- "type1": "1. Check if your username and password have been entered correctly.",
129
- "type2": "2. Check if your mobile phone is turned off or offline."
130
- },
131
- "noResetPassTip": {
132
- "tip": "If your password cannot be reset, please do the following steps to solve this issue:",
133
- "type1": "1. Check if your mobile phone is turned off or offline.",
134
- "type2": "2. Check if your password has been entered correctly."
135
- },
136
- "otherTip": {
137
- "tip": "Other:",
138
- "type1": "Please describe your problem in the following column."
139
- },
140
- "successTip": "Submitted successfully",
141
- "successTipMsg": "Your information has been submitted to the application administrator. Your feedback will be processed as soon as possible. Please wait patiently.",
142
- "form": {
143
- "phone": "Contact",
144
- "phonePlaceholder": "Ennter your email or phone number (required)",
145
- "question": "Problem",
146
- "questionDescript": "Problem description",
147
- "questionClip": "Problem screenshot",
148
- "upload": "Upload pictures",
149
- "submit": "Submit",
150
- "inputConcatWays": "Please enter contact information"
151
- }
152
- },
153
- "high": "High",
154
- "low": "Low",
155
- "middle": "Middle",
156
- "strong": "Strong",
157
- "weak": "Weak",
158
- "and": "and",
159
- "pleaseCheckReaded": "Please check \"I have read\"",
160
- "backLoginPage": "Return to login",
161
- "LoginSuccess": "Login Success",
162
- "unAppId": "Please pass in the App ID",
163
- "welcomeDoc": "Welcome to join {{name}}, in order to have a better experience, please improve your information first",
164
- "copied": "Copied",
165
- "bindEmailDoc": "You have not bound the mailbox yet, please enter the mailbox to bind",
166
- "copy": "Copy",
167
- "emailNotNull": "E-mail can not be empty",
168
- "setPassword": "Set password",
169
- "passwordNotNull": "password can not be blank",
170
- "LDAPAccountNotNull": "LDAP account cannot be empty",
171
- "captchaCodeNotNull": "verification code must be filled",
172
- "recoverCodeNotNull": "Recovery code cannot be empty",
173
- "accNotNull": "Account cannot be empty",
174
- "phoneOrEmailNotNull": "Mobile phone number or email cannot be empty",
175
- "inputVerifyCode": "please enter verification code",
176
- "SMS": "SMS Verification",
177
- "EmailVerification": "Email Verification",
178
- "OTPVerification": "OTP Verification",
179
- "faceVerification": "Face Verification",
180
- "retrievePassword": "Retrieve password",
181
- "registrationSuccess": "Registration Success",
182
- "repeatPasswordDoc": "The two passwords must be the same",
183
- "saveSuccess": "Save successfully",
184
- "copyFailed": "Copy Failed",
185
- "repeatPassword": "Please repeat the password",
186
- "phoneNotNull": "Mobile phone number cannot be empty",
187
- "networkError": "Network error, please retry",
188
- "downloadTotpAppAndroid": "Android download",
189
- "downloadTotpAppDocs": "Please use your mobile phone to scan the code to download the verifier",
190
- "downloadTotpAppIOS": "IOS download",
191
- "unBindEmaileDoc": "{{email}} has been bound to another account",
192
- "bindTotp": "Bind OTP",
193
- "checkEmail": "This Email is registed",
194
- "checkPhone": "This phone is registed",
195
- "loginFailCheck": "Reminder: Your password is wrong, you can try {{number}} times",
196
- "otpText1": "To ensure access security, please go to the OTP binding page",
197
- "faceText1": "Bind face Verification",
198
- "faceText2": "Please keep the camera open and unobstructed",
199
- "faceText3": "Start",
200
- "faceText4": "Try again",
201
- "checkPasswordHasSpace": "No spaces",
202
- "backToVerify": "back",
203
- "autoJumpToLogin": "Then it will automatically jump to the login page",
204
- "backToMFA": "Return to MFA binding",
205
- "bindSuccess": "Complete binding",
206
- "clickTodownload": "click to download",
207
- "goToLogin": "Direct Login",
208
- "mfaText1": "Scan the code to add MFA, check it on your mobile phone and enter the 6-digit security code.",
209
- "noQuestions": "no problem,",
210
- "noValidator": "No validator please",
211
- "pleaseRecordKey": "Please record the key",
212
- "timeoutLDAP": "Request timed out, LDAP configuration error",
213
- "totpText1": "Please keep the recovery code properly",
214
- "totpText2": "If your MFA is lost, you will need a recovery code",
215
- "usePhoneOpen": "Please open on your phone",
216
- "useRecoveryCodetips": "After successful login, we will generate a new recovery code.",
217
- "passwordAgain": "Enter the password again"
218
- }
@@ -1,6 +0,0 @@
1
- import common from './common.json'
2
- import login from './login.json'
3
- import user from './user.json'
4
- import map from './map.json'
5
-
6
- export { common, login, user, map }