@authing/react-ui-components 3.0.2-alpha.2 → 3.0.2-beta.12

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 (254) hide show
  1. package/lib/index.d.ts +620 -52
  2. package/lib/index.min.css +2 -2
  3. package/lib/index.min.js +1 -1
  4. package/package.json +29 -8
  5. package/.eslintignore +0 -6
  6. package/.eslintrc.js +0 -7
  7. package/.prettierrc +0 -5
  8. package/.vscode/settings.json +0 -31
  9. package/build/asset-manifest.json +0 -26
  10. package/build/favicon.ico +0 -0
  11. package/build/index.html +0 -1
  12. package/build/logo192.png +0 -0
  13. package/build/logo512.png +0 -0
  14. package/build/manifest.json +0 -25
  15. package/build/robots.txt +0 -3
  16. package/build/static/css/2.9512539b.chunk.css +0 -3
  17. package/build/static/css/2.9512539b.chunk.css.map +0 -1
  18. package/build/static/css/main.0ff9e24a.chunk.css +0 -2
  19. package/build/static/css/main.0ff9e24a.chunk.css.map +0 -1
  20. package/build/static/js/2.1105ecfb.chunk.js +0 -3
  21. package/build/static/js/2.1105ecfb.chunk.js.LICENSE.txt +0 -102
  22. package/build/static/js/2.1105ecfb.chunk.js.map +0 -1
  23. package/build/static/js/3.fd17f196.chunk.js +0 -2
  24. package/build/static/js/3.fd17f196.chunk.js.map +0 -1
  25. package/build/static/js/main.a47645ff.chunk.js +0 -2
  26. package/build/static/js/main.a47645ff.chunk.js.map +0 -1
  27. package/build/static/js/runtime-main.ef138021.js +0 -2
  28. package/build/static/js/runtime-main.ef138021.js.map +0 -1
  29. package/build/static/media/loading.4a67a5f3.svg +0 -29
  30. package/components/AuthingDropdown/index.tsx +0 -52
  31. package/components/AuthingDropdown/style.less +0 -43
  32. package/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  33. package/components/AuthingGuard/AppMFALayout/style.less +0 -12
  34. package/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  35. package/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  36. package/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  37. package/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  38. package/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  39. package/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  40. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -84
  41. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  42. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  43. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  44. package/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  45. package/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  46. package/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -166
  47. package/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  48. package/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  49. package/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  50. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  51. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  52. package/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  53. package/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  54. package/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  55. package/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  56. package/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  57. package/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  58. package/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  59. package/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -59
  60. package/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  61. package/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  62. package/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  63. package/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  64. package/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  65. package/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  66. package/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  67. package/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  68. package/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  69. package/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  70. package/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  71. package/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  72. package/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  73. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  74. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  75. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  76. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  77. package/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  78. package/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  79. package/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  80. package/components/AuthingGuard/Forms/index.ts +0 -13
  81. package/components/AuthingGuard/GuardLayout/index.tsx +0 -474
  82. package/components/AuthingGuard/GuardLayout/style.less +0 -111
  83. package/components/AuthingGuard/Header/index.tsx +0 -25
  84. package/components/AuthingGuard/Header/style.less +0 -52
  85. package/components/AuthingGuard/IconFont/iconfont.js +0 -74
  86. package/components/AuthingGuard/IconFont/index.tsx +0 -19
  87. package/components/AuthingGuard/IconFont/style.less +0 -6
  88. package/components/AuthingGuard/IconFont/svg.js +0 -2
  89. package/components/AuthingGuard/LoginLayout/index.tsx +0 -161
  90. package/components/AuthingGuard/LoginLayout/style.less +0 -0
  91. package/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  92. package/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  93. package/components/AuthingGuard/MfaLayout/style.less +0 -3
  94. package/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  95. package/components/AuthingGuard/RegisterLayout/style.less +0 -0
  96. package/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  97. package/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  98. package/components/AuthingGuard/api/appConfig.ts +0 -146
  99. package/components/AuthingGuard/api/index.ts +0 -3
  100. package/components/AuthingGuard/api/sso.ts +0 -29
  101. package/components/AuthingGuard/api/userPoolConfig.ts +0 -111
  102. package/components/AuthingGuard/constants.ts +0 -105
  103. package/components/AuthingGuard/hooks/index.tsx +0 -70
  104. package/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  105. package/components/AuthingGuard/index.tsx +0 -126
  106. package/components/AuthingGuard/style.less +0 -103
  107. package/components/AuthingGuard/types/Forms.ts +0 -94
  108. package/components/AuthingGuard/types/GuardConfig.ts +0 -420
  109. package/components/AuthingGuard/types/GuardState.ts +0 -7
  110. package/components/AuthingGuard/types/Locales.ts +0 -12
  111. package/components/AuthingGuard/types/index.ts +0 -4
  112. package/components/AuthingTabs/index.tsx +0 -98
  113. package/components/AuthingTabs/style.less +0 -135
  114. package/components/BindTotp/core/bindSuccess.tsx +0 -61
  115. package/components/BindTotp/core/securityCode.tsx +0 -119
  116. package/components/BindTotp/index.tsx +0 -134
  117. package/components/BindTotp/interface.ts +0 -30
  118. package/components/BindTotp/styles.less +0 -57
  119. package/components/ChangeLanguage/index.tsx +0 -35
  120. package/components/ChangePassword/core/firstLoginReset.tsx +0 -104
  121. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  122. package/components/ChangePassword/index.tsx +0 -59
  123. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  124. package/components/CompleteInfo/index.tsx +0 -45
  125. package/components/CompleteInfo/interface.ts +0 -40
  126. package/components/CompleteInfo/styles.less +0 -7
  127. package/components/CopyAbleText/index.tsx +0 -54
  128. package/components/CopyAbleText/style.less +0 -13
  129. package/components/DownloadAuthenticator/index.tsx +0 -97
  130. package/components/DownloadAuthenticator/interface.ts +0 -22
  131. package/components/DownloadAuthenticator/styles.less +0 -52
  132. package/components/Error/index.tsx +0 -21
  133. package/components/Error/interface.ts +0 -9
  134. package/components/Error/styles.less +0 -12
  135. package/components/ForgetPassword/core/resetPassword.tsx +0 -162
  136. package/components/ForgetPassword/index.tsx +0 -75
  137. package/components/ForgetPassword/interface.ts +0 -32
  138. package/components/Guard/Guard.tsx +0 -242
  139. package/components/Guard/authClient.ts +0 -55
  140. package/components/Guard/config.ts +0 -19
  141. package/components/Guard/event.ts +0 -52
  142. package/components/Guard/index.tsx +0 -4
  143. package/components/Guard/module.ts +0 -19
  144. package/components/Guard/stateMachine.ts +0 -133
  145. package/components/Guard/styles.less +0 -444
  146. package/components/IconFont/iconfont.js +0 -74
  147. package/components/IconFont/index.tsx +0 -16
  148. package/components/IconFont/style.less +0 -6
  149. package/components/IconFont/svg.js +0 -2
  150. package/components/ImagePro/index.tsx +0 -52
  151. package/components/ImagePro/styles.less +0 -40
  152. package/components/InputNumber/index.tsx +0 -33
  153. package/components/Login/codemap.ts +0 -39
  154. package/components/Login/core/withAD.tsx +0 -9
  155. package/components/Login/core/withAppQrcode.tsx +0 -49
  156. package/components/Login/core/withLDAP.tsx +0 -146
  157. package/components/Login/core/withPassword.tsx +0 -176
  158. package/components/Login/core/withPhonecode.tsx +0 -121
  159. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  160. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  161. package/components/Login/index.tsx +0 -368
  162. package/components/Login/props.ts +0 -74
  163. package/components/Login/socialLogin/index.tsx +0 -413
  164. package/components/Login/socialLogin/style.less +0 -61
  165. package/components/Login/styles.less +0 -53
  166. package/components/MFA/codemap.ts +0 -21
  167. package/components/MFA/core/email.tsx +0 -225
  168. package/components/MFA/core/face.tsx +0 -297
  169. package/components/MFA/core/face_deps.tsx +0 -37
  170. package/components/MFA/core/sms.tsx +0 -229
  171. package/components/MFA/core/totp.tsx +0 -137
  172. package/components/MFA/index.tsx +0 -137
  173. package/components/MFA/mfaMethods/index.tsx +0 -81
  174. package/components/MFA/mfaMethods/style.less +0 -39
  175. package/components/MFA/props.ts +0 -51
  176. package/components/MFA/styles.less +0 -93
  177. package/components/NeedHelpView/core/describeQuestions.tsx +0 -223
  178. package/components/NeedHelpView/index.tsx +0 -99
  179. package/components/RecoveryCode/core/useCode.tsx +0 -71
  180. package/components/RecoveryCode/index.tsx +0 -27
  181. package/components/RecoveryCode/interface.ts +0 -31
  182. package/components/RecoveryCode/style.less +0 -13
  183. package/components/Register/codemap.ts +0 -16
  184. package/components/Register/components/Agreements/index.tsx +0 -81
  185. package/components/Register/components/Agreements/style.less +0 -44
  186. package/components/Register/core/WithEmail.tsx +0 -236
  187. package/components/Register/core/WithPhone.tsx +0 -184
  188. package/components/Register/index.tsx +0 -123
  189. package/components/Register/props.ts +0 -50
  190. package/components/SendCode/SendCodeBtn.tsx +0 -96
  191. package/components/SendCode/index.tsx +0 -94
  192. package/components/SendCode/style.less +0 -31
  193. package/components/ShieldSpin/index.tsx +0 -27
  194. package/components/ShieldSpin/loading.svg +0 -29
  195. package/components/SubmitButton/index.tsx +0 -50
  196. package/components/Type/index.ts +0 -52
  197. package/components/ValidatorRules/EmailFormItem.tsx +0 -81
  198. package/components/ValidatorRules/PhoneFormItem.tsx +0 -90
  199. package/components/ValidatorRules/index.ts +0 -14
  200. package/components/VerifyCodeInput/index.tsx +0 -76
  201. package/components/VerifyCodeInput/style.less +0 -24
  202. package/components/_utils/GuardErrorCode.ts +0 -8
  203. package/components/_utils/clipboard.ts +0 -27
  204. package/components/_utils/config.ts +0 -121
  205. package/components/_utils/guradHttp.ts +0 -93
  206. package/components/_utils/hooks/index.ts +0 -64
  207. package/components/_utils/http.ts +0 -85
  208. package/components/_utils/index.ts +0 -319
  209. package/components/_utils/locales/en/common.json +0 -223
  210. package/components/_utils/locales/en/index.ts +0 -6
  211. package/components/_utils/locales/en/login.json +0 -96
  212. package/components/_utils/locales/en/map.json +0 -4
  213. package/components/_utils/locales/en/user.json +0 -82
  214. package/components/_utils/locales/index.ts +0 -45
  215. package/components/_utils/locales/zh/common.json +0 -223
  216. package/components/_utils/locales/zh/index.ts +0 -6
  217. package/components/_utils/locales/zh/login.json +0 -96
  218. package/components/_utils/locales/zh/map.json +0 -4
  219. package/components/_utils/locales/zh/user.json +0 -82
  220. package/components/_utils/popupCenter.ts +0 -48
  221. package/components/assets/images/error.png +0 -0
  222. package/components/context/base.tsx +0 -28
  223. package/components/context/global/context.tsx +0 -39
  224. package/components/context/global/reducer.tsx +0 -56
  225. package/components/context/module/context.tsx +0 -23
  226. package/components/index.ts +0 -12
  227. package/config/antdReplacer.js +0 -51
  228. package/config/env.js +0 -104
  229. package/config/getHttpsConfig.js +0 -66
  230. package/config/jest/cssTransform.js +0 -14
  231. package/config/jest/fileTransform.js +0 -40
  232. package/config/modules.js +0 -134
  233. package/config/paths.js +0 -71
  234. package/config/pnpTs.js +0 -35
  235. package/config/webpack.config.js +0 -835
  236. package/config/webpackDevServer.config.js +0 -130
  237. package/examples.tsx +0 -107
  238. package/index.js +0 -1
  239. package/lib/static/media/loading.4a67a5f3.svg +0 -29
  240. package/logo.svg +0 -7
  241. package/public/favicon.ico +0 -0
  242. package/public/index.html +0 -43
  243. package/public/logo192.png +0 -0
  244. package/public/logo512.png +0 -0
  245. package/public/manifest.json +0 -25
  246. package/public/robots.txt +0 -3
  247. package/react-app-env.d.ts +0 -71
  248. package/reportWebVitals.ts +0 -15
  249. package/scripts/build.js +0 -208
  250. package/scripts/lib.js +0 -200
  251. package/scripts/start.js +0 -162
  252. package/scripts/test.js +0 -49
  253. package/setupTests.ts +0 -5
  254. package/tsconfig.json +0 -30
@@ -1,93 +0,0 @@
1
- .authing-g2-mfa-title {
2
- color: #282d3c;
3
- font-size: 18px;
4
- font-weight: 600;
5
- text-align: center;
6
- margin-bottom: 8px;
7
- margin-top: 40px;
8
- }
9
-
10
- .authing-g2-mfa-tips {
11
- font-size: 14px;
12
- color: #545968;
13
- text-align: center;
14
- margin-bottom: 24px;
15
- }
16
-
17
- .g2-mfa-content {
18
- margin: 0 38px;
19
-
20
- .g2-mfa-submit-button {
21
- margin-top: 32px !important;
22
- }
23
-
24
- .bind-totp {
25
- margin-top: 80px !important;
26
- }
27
-
28
- .authing-ant-form-item-control-input-content {
29
- display: flex;
30
- justify-content: center;
31
- }
32
-
33
- .g2-mfa-totp-verify-input {
34
- text-align: center;
35
- .authing-code-input-item {
36
- &:not(:first-child) {
37
- margin-left: 14px;
38
- }
39
- }
40
- }
41
-
42
- .authing-ant-form-horizontal {
43
- display: flex;
44
- justify-content: center;
45
- flex-direction: column;
46
- }
47
-
48
- .g2-mfa-face-image {
49
- margin: 0px auto;
50
- display: block;
51
- margin-bottom: 24px;
52
- }
53
- .g2-mfa-face-identifying {
54
- display: flex;
55
- justify-content: center;
56
- align-items: center;
57
-
58
- .video-round {
59
- width: 210px;
60
- height: 210px;
61
- border-radius: 50%;
62
- vertical-align: middle;
63
- }
64
- .mesh {
65
- z-index: 100;
66
- cursor: pointer;
67
- user-select: none;
68
- color: white;
69
- position: absolute;
70
- display: flex;
71
- justify-content: center;
72
- align-items: center;
73
- cursor: pointer;
74
- background: rgba(0, 0, 0, 0.4);
75
- }
76
- .ring {
77
- width: 240px;
78
- height: 240px;
79
- position: absolute;
80
- transform: rotate(270deg);
81
- }
82
- }
83
- }
84
- .svg-circle-bg {
85
- stroke-width: 4;
86
- // stroke: rgba(255, 161, 39, 1);
87
- }
88
- .svg-circle-running {
89
- stroke-width: 4;
90
- transition: all 0.2s linear;
91
- stroke: #396aff;
92
- stroke-linecap: round;
93
- }
@@ -1,223 +0,0 @@
1
- import React, { useRef, useState } from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { Form, Input, Modal, Select, Upload } from 'antd'
4
- import SubmitButton from '../../SubmitButton'
5
- import { UserOutlined, PlusOutlined } from '@ant-design/icons'
6
- import { UploadFile } from 'antd/lib/upload/interface'
7
- import { useGuardHttp } from '../../_utils/guradHttp'
8
- import { fieldRequiredRule } from '../../_utils'
9
-
10
- interface describeQuestionsProps {
11
- appId: string
12
- host: string
13
- onSuccess: any
14
- }
15
-
16
- export const DescribeQuestions = (props: describeQuestionsProps) => {
17
- const { t } = useTranslation()
18
-
19
- // 不清楚为什么放出去之后,i18n 的结果全是 undefeated
20
- const typeProblemMap: any = {
21
- 0: [
22
- t('common.problem.noVerifyTip.tip'),
23
- t('common.problem.noVerifyTip.type1'),
24
- t('common.problem.noVerifyTip.type2'),
25
- t('common.problem.noVerifyTip.type3'),
26
- ],
27
- 1: [
28
- t('common.problem.noLoginTip.tip'),
29
- t('common.problem.noLoginTip.type1'),
30
- t('common.problem.noLoginTip.type2'),
31
- ],
32
- 2: [
33
- t('common.problem.noRegisterTip.tip'),
34
- t('common.problem.noRegisterTip.type1'),
35
- t('common.problem.noRegisterTip.type2'),
36
- t('common.problem.noRegisterTip.type3'),
37
- ],
38
- 3: [
39
- t('common.problem.noAccountTip.tip'),
40
- t('common.problem.noAccountTip.type1'),
41
- t('common.problem.noAccountTip.type2'),
42
- ],
43
- 4: [
44
- t('common.problem.noResetPassTip.tip'),
45
- t('common.problem.noResetPassTip.type1'),
46
- t('common.problem.noResetPassTip.type2'),
47
- ],
48
- 5: [t('common.problem.otherTip.tip'), t('common.problem.otherTip.type1')],
49
- 6: [t('common.problem.otherTip.tip'), t('common.problem.otherTip.type1')],
50
- }
51
-
52
- const typeOperations = [
53
- {
54
- label: t('common.problem.noVerify'),
55
- value: 0,
56
- },
57
- {
58
- label: t('common.problem.noLogin'),
59
- value: 1,
60
- },
61
- {
62
- label: t('common.problem.noRegister'),
63
- value: 2,
64
- },
65
- {
66
- label: t('common.problem.noAccount'),
67
- value: 3,
68
- },
69
- {
70
- label: t('common.problem.noResetPass'),
71
- value: 4,
72
- },
73
- {
74
- label: t('common.problem.locked'),
75
- value: 5,
76
- },
77
- {
78
- label: t('common.problem.other'),
79
- value: 6,
80
- },
81
- ]
82
-
83
- const [form] = Form.useForm()
84
- const { post } = useGuardHttp()
85
- const [uploadUrl, setUploadUrl] = useState([])
86
- const [previewVisible, setPreviewVisible] = useState(false)
87
- const [previewImage, setPreviewImage] = useState()
88
- const [fileList, setFileList] = useState<UploadFile<any>[]>([])
89
- const [typeProblem, setTypeProblem] = useState(0)
90
- const submitButtonRef = useRef<any>(null)
91
- const textMap = typeProblemMap[typeProblem]
92
-
93
- const onFinish = (values: any) => {
94
- submitButtonRef?.current?.onSpin(true)
95
- const params = {
96
- type: typeProblem,
97
- description: values.description,
98
- phone: values.identify,
99
- images: uploadUrl,
100
- appId: props.appId,
101
- }
102
- let context = post('/api/v2/feedback', params)
103
- context.then((res) => {
104
- if (res.code === 200) {
105
- submitButtonRef?.current?.onSpin(false)
106
- props.onSuccess()
107
- }
108
- })
109
- }
110
-
111
- const handlePreview = async (file: any) => {
112
- // setPreviewImage(file.url);
113
- // file 没有 url 属性,需要改成下面的用法
114
- let url = file.response.data.url
115
- setPreviewImage(url)
116
- setPreviewVisible(true)
117
- }
118
-
119
- return (
120
- <div className="authing-g2-describe-questions">
121
- <Form
122
- name="resetPassword"
123
- layout="vertical"
124
- form={form}
125
- onFinish={onFinish}
126
- onFinishFailed={() => {
127
- submitButtonRef?.current?.onError()
128
- }}
129
- autoComplete="off"
130
- >
131
- <Form.Item
132
- className="authing-g2-input-form"
133
- name="identify"
134
- label={t('common.problem.form.phone')}
135
- rules={fieldRequiredRule(t('common.problem.form.phone'))}
136
- >
137
- <Input
138
- className="authing-g2-input"
139
- autoComplete="tel"
140
- size="large"
141
- placeholder={t('login.inputPhoneOrEmail')}
142
- prefix={<UserOutlined style={{ color: '#878A95' }} />}
143
- />
144
- </Form.Item>
145
- <Form.Item
146
- className="authing-g2-input-form"
147
- label={t('common.problem.form.question')}
148
- name="questionPicker"
149
- initialValue={typeProblem}
150
- >
151
- <Select
152
- className="authing-g2-select"
153
- onChange={(value: number) => {
154
- setTypeProblem(value)
155
- }}
156
- >
157
- {typeOperations?.map(({ value, label }) => (
158
- <Select.Option key={value} value={value}>
159
- {label}
160
- </Select.Option>
161
- ))}
162
- </Select>
163
- </Form.Item>
164
- <div className="authing-g2-input-form">
165
- {textMap?.map((item: any, index: any) => (
166
- <div key={index}>{item}</div>
167
- ))}
168
- </div>
169
-
170
- <Form.Item
171
- className="authing-g2-input-form"
172
- name="description"
173
- label={t('common.problem.form.questionDescript')}
174
- >
175
- <Input.TextArea className="authing-g2-input" />
176
- </Form.Item>
177
-
178
- <div className="authing-g2-input-form">
179
- <div className="label-title">
180
- {t('common.problem.form.questionClip')}
181
- </div>
182
- <div className="g2-questions">
183
- <Upload
184
- action={`${props.host}/api/v2/upload?folder=photos`}
185
- listType="picture-card"
186
- accept="image/png, image/jpeg, image/jpg"
187
- className="authing-g2-questions-upload-self"
188
- fileList={fileList}
189
- onPreview={handlePreview}
190
- onChange={(e) => {
191
- setFileList(e.fileList)
192
- const imgUrl: any = e.fileList.map((item: any) => {
193
- const response = item.response
194
- return response?.data.url
195
- })
196
- setUploadUrl(imgUrl)
197
- }}
198
- >
199
- {fileList.length >= 5 ? null : <PlusOutlined />}
200
- </Upload>
201
- </div>
202
- </div>
203
-
204
- <Form.Item className="authing-g2-input-form submit-form">
205
- <SubmitButton
206
- className="forget-password"
207
- text={t('common.problem.form.submit')}
208
- ref={submitButtonRef}
209
- />
210
- </Form.Item>
211
- </Form>
212
-
213
- <Modal
214
- visible={previewVisible}
215
- title={null}
216
- footer={null}
217
- onCancel={() => setPreviewVisible(false)}
218
- >
219
- <img alt="example" style={{ width: '100%' }} src={previewImage} />
220
- </Modal>
221
- </div>
222
- )
223
- }
@@ -1,99 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { ImagePro } from '../ImagePro'
4
- import { DescribeQuestions } from './core/describeQuestions'
5
- import { GuardModuleType } from '../Guard/module'
6
- import SubmitButton from '../SubmitButton'
7
-
8
- export const GuardNeedHelpView = (props: any) => {
9
- const [mode, setMode] = useState<'typing' | 'success'>('typing')
10
- const { t } = useTranslation()
11
- const cdnBase = props.config.__publicConfig__?.cdnBase
12
- const timerRef = useRef<any>(0)
13
- const [countDown, setCountDown] = useState(5)
14
-
15
- useEffect(() => {
16
- return () => clearInterval(timerRef.current)
17
- }, [])
18
-
19
- useEffect(() => {
20
- if (countDown <= 0) {
21
- clearInterval(timerRef.current)
22
- props.__changeModule(GuardModuleType.LOGIN)
23
- }
24
- // eslint-disable-next-line react-hooks/exhaustive-deps
25
- }, [countDown])
26
-
27
- const onSuccess = () => {
28
- setMode('success')
29
- setCountDown(5)
30
- timerRef.current = setInterval(() => {
31
- setCountDown((prev) => {
32
- return prev - 1
33
- })
34
- }, 1000)
35
- }
36
-
37
- if (mode === 'typing') {
38
- return (
39
- <div className="g2-view-container">
40
- <div className="g2-view-header">
41
- <ImagePro
42
- src={props.config?.logo}
43
- size={48}
44
- borderRadius={4}
45
- alt=""
46
- className="icon"
47
- />
48
-
49
- <div className="title">{t('common.problem.title')}</div>
50
- </div>
51
- <div className="g2-view-tabs">
52
- <DescribeQuestions
53
- appId={props.config.__publicConfig__.id}
54
- host={props.config.__appHost__}
55
- onSuccess={onSuccess}
56
- />
57
- </div>
58
- <div className="g2-tips-line ">
59
- <div className="back-to-login">
60
- <span className="gray">{t('common.noQuestions')}</span>
61
- <span
62
- className="link-like"
63
- onClick={() => props.__changeModule(GuardModuleType.LOGIN)}
64
- >
65
- {t('common.goToLogin')}
66
- </span>
67
- </div>
68
- </div>
69
- </div>
70
- )
71
- }
72
-
73
- // mode === 'success' 的情况
74
-
75
- return (
76
- <div className="g2-view-container">
77
- <div className="g2-view-tabs g2-questions-send-success-page">
78
- <ImagePro
79
- className="plate"
80
- src={`${cdnBase}/questions-send-ok.png`}
81
- alt=""
82
- width={191}
83
- height={146}
84
- />
85
- <div className="title">{t('common.problem.successTip')}</div>
86
- <div className="message">{t('common.problem.successTipMsg')}</div>
87
- <SubmitButton
88
- onClick={() => {
89
- props.__changeModule(GuardModuleType.LOGIN)
90
- }}
91
- text={t('common.backLoginPage')}
92
- />
93
- <div className="timer-tip">
94
- {countDown} {t('common.pToLogin')}
95
- </div>
96
- </div>
97
- </div>
98
- )
99
- }
@@ -1,71 +0,0 @@
1
- import { LockOutlined } from '@ant-design/icons'
2
- import { Form, Input } from 'antd'
3
- import React, { useRef } from 'react'
4
- import { useTranslation } from 'react-i18next'
5
- import SubmitButton from '../../SubmitButton'
6
- import { useGuardHttp } from '../../_utils/guradHttp'
7
-
8
- export interface UseCodeProps {
9
- mfaToken: string
10
- }
11
-
12
- export const UseCode: React.FC<UseCodeProps> = ({ mfaToken }) => {
13
- const { t } = useTranslation()
14
-
15
- const [form] = Form.useForm()
16
-
17
- const { post } = useGuardHttp()
18
-
19
- const onFinish = async () => {
20
- submitButtonRef.current?.onSpin(true)
21
-
22
- await post(
23
- '/api/v2/mfa/totp/recovery',
24
- {
25
- recoveryCode: form.getFieldValue('recoveryCode'),
26
- },
27
- {
28
- headers: {
29
- authorization: mfaToken,
30
- },
31
- }
32
- )
33
- }
34
-
35
- let submitButtonRef = useRef<any>(null)
36
-
37
- return (
38
- <>
39
- <p className="authing-g2-mfa-title">{t('common.useRecoverCode')}</p>
40
- <p className="authing-g2-mfa-tips">{t('login.mfaAfterReset')}</p>
41
- <Form
42
- form={form}
43
- onFinish={onFinish}
44
- onFinishFailed={() => submitButtonRef.current.onError()}
45
- >
46
- <Form.Item
47
- className="authing-g2-input-form"
48
- name="recoveryCode"
49
- rules={[
50
- {
51
- required: true,
52
- message: t('login.inputRecoverCode'),
53
- },
54
- ]}
55
- >
56
- <Input
57
- className="authing-g2-input"
58
- autoComplete="email"
59
- size="large"
60
- placeholder={t('login.inputRecoverCode')}
61
- prefix={<LockOutlined style={{ color: '#878A95' }} />}
62
- />
63
- </Form.Item>
64
-
65
- <Form.Item className="authing-g2-input-form submit-form">
66
- <SubmitButton text={t('common.sure')} ref={submitButtonRef} />
67
- </Form.Item>
68
- </Form>
69
- </>
70
- )
71
- }
@@ -1,27 +0,0 @@
1
- import React from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { IconFont } from '../IconFont'
4
- import { UseCode } from './core/useCode'
5
- import { GuardRecoveryCodeViewProps } from './interface'
6
- import './style.less'
7
- const window: Window = require('global/window')
8
-
9
- export const GuardRecoveryCodeView: React.FC<GuardRecoveryCodeViewProps> = ({
10
- initData,
11
- }) => {
12
- const onBack = () => window.history.back()
13
- const { t } = useTranslation()
14
- return (
15
- <div className="g2-view-container g2-mfa-recovery-code">
16
- <div className="g2-view-back">
17
- <span onClick={onBack}>
18
- <IconFont type="authing-back" />
19
- <span>{t('common.backToVerify')}</span>
20
- </span>
21
- </div>
22
- <div className="g2-mfa-content">
23
- <UseCode mfaToken={initData.mfaToken} />
24
- </div>
25
- </div>
26
- )
27
- }
@@ -1,31 +0,0 @@
1
- import { getDefaultG2Config, IG2Config, IG2Events, IG2FCProps } from '../Type'
2
- import { AuthenticationClient, User } from '..'
3
-
4
- export interface RecoveryCodeConfig extends IG2Config {}
5
-
6
- const defaultConfig: RecoveryCodeConfig = {
7
- ...getDefaultG2Config(),
8
- }
9
-
10
- export const getDefaultRecoveryCodeConfig = (): RecoveryCodeConfig => ({
11
- ...getDefaultG2Config(),
12
- ...defaultConfig,
13
- })
14
-
15
- export interface RecoveryCodeEvents extends IG2Events {
16
- onLogin?: (user: User, authClient: AuthenticationClient) => void
17
- }
18
-
19
- export interface GuardRecoveryCodeInitData {
20
- mfaToken: string
21
- }
22
-
23
- export interface GuardRecoveryCodeProps extends IG2FCProps, RecoveryCodeEvents {
24
- config: Partial<RecoveryCodeConfig>
25
- initData: GuardRecoveryCodeInitData
26
- }
27
-
28
- export interface GuardRecoveryCodeViewProps extends GuardRecoveryCodeProps {
29
- config: RecoveryCodeConfig
30
- initData: GuardRecoveryCodeInitData
31
- }
@@ -1,13 +0,0 @@
1
- .g2-mfa-recovery-code {
2
- .authing-g2-mfa-title {
3
- margin-top: 92px;
4
- }
5
-
6
- .authing-g2-mfa-tips {
7
- margin-bottom: 52px;
8
- }
9
-
10
- .submit-form {
11
- margin-top: 64px !important;
12
- }
13
- }
@@ -1,16 +0,0 @@
1
- import { ErrorCode } from '../_utils/GuardErrorCode'
2
- import { GuardModuleAction } from '../Guard/module'
3
-
4
- export const codeMap: Record<number, GuardModuleAction> = {
5
- [ErrorCode.USER_EXISTENCE]: {
6
- action: 'message',
7
- },
8
- [ErrorCode.INPUT_CAPTCHACODE]: {
9
- // 需要输入图形验证码
10
- action: 'message',
11
- },
12
- 2333: {
13
- // 密码错误
14
- action: 'message',
15
- },
16
- }
@@ -1,81 +0,0 @@
1
- import React, { FC, useState, useMemo, useEffect } from 'react'
2
- import { Space, Checkbox } from 'antd'
3
- import './style.less'
4
- import { getClassnames } from '../../../_utils'
5
- import { Agreement } from '../../../AuthingGuard/api'
6
-
7
- export interface AgreementsProps {
8
- value?: boolean
9
- onChange?: (value: boolean) => void
10
- style?: React.CSSProperties
11
- agreements: Agreement[]
12
- showError?: boolean
13
- }
14
-
15
- export const Agreements: FC<AgreementsProps> = ({
16
- showError,
17
- onChange = () => {},
18
- style,
19
- agreements,
20
- }) => {
21
- const [acceptList, setAcceptList] = useState<(string | number)[]>([])
22
-
23
- const toggleItemCheck = (id: string | number) => {
24
- setAcceptList((prev) => {
25
- if (prev.includes(id)) {
26
- return prev.filter((item) => item !== id)
27
- }
28
- return [...prev, id]
29
- })
30
- }
31
-
32
- /** 是否可以注册 */
33
- const isAccept = useMemo(() => {
34
- /** 所有必须勾选的都勾了就可以通过 */
35
- return agreements
36
- .filter((item) => item.required)
37
- .every((item) => acceptList.includes(item.id))
38
- }, [acceptList, agreements])
39
-
40
- useEffect(() => {
41
- onChange(isAccept)
42
- }, [isAccept, onChange])
43
-
44
- return (
45
- <div
46
- className={getClassnames([
47
- 'authing-agreements',
48
- showError && 'authing-agreements-error',
49
- ])}
50
- >
51
- {agreements.map((item) => {
52
- return (
53
- <div
54
- key={item.id}
55
- style={{ ...style }}
56
- className={getClassnames([
57
- 'authing-agreements-item',
58
- item.required &&
59
- !acceptList.includes(item.id) &&
60
- 'authing-agreements-item-invalid',
61
- ])}
62
- onClick={() => toggleItemCheck(item.id)}
63
- >
64
- <Space align="start" size={5}>
65
- <Checkbox
66
- className="authing-agreements-checkbox"
67
- checked={acceptList.includes(item.id)}
68
- />
69
- <div
70
- className="authing-agreements-item-content"
71
- dangerouslySetInnerHTML={{
72
- __html: item.title,
73
- }}
74
- ></div>
75
- </Space>
76
- </div>
77
- )
78
- })}
79
- </div>
80
- )
81
- }
@@ -1,44 +0,0 @@
1
- .authing-agreements {
2
- margin-top: 20px;
3
- margin-bottom: 20px;
4
- &.authing-agreements-error {
5
- .authing-agreements-item-invalid {
6
- color: #ff4d4f;
7
- a {
8
- color: #ff4d4f;
9
- }
10
- :global(.ant-checkbox-inner) {
11
- border-color: #ff4d4f;
12
- }
13
- }
14
- }
15
- }
16
-
17
- .authing-agreements-item {
18
- color: #999999;
19
- user-select: none;
20
- cursor: pointer;
21
- font-size: 12px;
22
- &:not(:first-child) {
23
- margin-top: 4px;
24
- }
25
- p {
26
- margin-bottom: 0;
27
- display: inline-block;
28
- }
29
- }
30
-
31
- .authing-agreements-checkbox {
32
- margin-bottom: 2px;
33
- :global(.ant-checkbox-inner) {
34
- width: 14px;
35
- height: 14px;
36
- &::after {
37
- left: 20%;
38
- }
39
- }
40
- }
41
-
42
- .authing-agreements-item-content {
43
- line-height: 23px;
44
- }