@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.
- package/.vscode/settings.json +1 -1
- package/LICENSE +21 -0
- package/config/env.js +26 -24
- package/config/paths.js +3 -3
- package/config/webpack.config.js +29 -7
- package/lib/index.d.ts +211 -1252
- package/lib/index.min.css +1 -2
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.LICENSE.txt +0 -32
- package/package.json +14 -20
- package/scripts/build.js +83 -79
- package/scripts/start.js +73 -69
- package/scripts/test.js +23 -19
- package/{components → src/common}/AuthingDropdown/index.tsx +1 -1
- package/{components → src/common}/AuthingDropdown/style.less +0 -0
- package/{components → src/common}/AuthingTabs/index.tsx +1 -1
- package/{components → src/common}/AuthingTabs/style.less +0 -0
- package/{components → src/common}/CopyAbleText/index.tsx +1 -1
- package/{components → src/common}/CopyAbleText/style.less +0 -0
- package/{components → src/common}/VerifyCodeInput/index.tsx +0 -0
- package/{components → src/common}/VerifyCodeInput/style.less +0 -0
- package/{components → src/components}/AuthingGuard/AppMFALayout/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/AppMFALayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/ADLoginForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/Agreements/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/Agreements/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +3 -3
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +4 -2
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/index.tsx +4 -9
- package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/PasswordLoginForm/index.tsx +3 -3
- package/{components → src/components}/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +4 -2
- package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +7 -7
- package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/UploadImage/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/index.ts +0 -0
- package/{components → src/components}/AuthingGuard/GuardLayout/index.tsx +17 -3
- package/{components → src/components}/AuthingGuard/GuardLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Header/index.tsx +6 -3
- package/{components → src/components}/AuthingGuard/Header/style.less +23 -11
- package/{components → src/components}/AuthingGuard/IconFont/iconfont.js +0 -0
- package/{components → src/components}/AuthingGuard/IconFont/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/IconFont/style.less +0 -0
- package/{components → src/components}/AuthingGuard/IconFont/svg.js +0 -0
- package/{components → src/components}/AuthingGuard/LoginLayout/index.tsx +69 -25
- package/{components → src/components}/AuthingGuard/LoginLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/MfaLayout/Steps.ts +0 -0
- package/{components → src/components}/AuthingGuard/MfaLayout/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/MfaLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/RegisterLayout/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/RegisterLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/ResetPwdLayout/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/ToggleLang/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/api/appConfig.ts +22 -14
- package/{components/_utils → src/components/AuthingGuard/api}/http.ts +33 -30
- package/{components → src/components}/AuthingGuard/api/index.ts +0 -0
- package/{components → src/components}/AuthingGuard/api/sso.ts +1 -1
- package/{components → src/components}/AuthingGuard/api/userPoolConfig.ts +3 -2
- package/{components → src/components}/AuthingGuard/constants.ts +2 -2
- package/{components → src/components}/AuthingGuard/hooks/index.tsx +0 -0
- package/{components → src/components}/AuthingGuard/hooks/useScreenSize.tsx +0 -0
- package/{components → src/components}/AuthingGuard/index.tsx +11 -3
- package/{components/_utils → src/components/AuthingGuard}/locales/en/common.json +26 -70
- package/{components/_utils → src/components/AuthingGuard}/locales/en/index.ts +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/en/login.json +19 -21
- package/{components/_utils → src/components/AuthingGuard}/locales/en/map.json +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/en/user.json +3 -4
- package/{components/_utils → src/components/AuthingGuard}/locales/index.ts +2 -2
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/common.json +9 -53
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/index.ts +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/login.json +4 -6
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/map.json +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/user.json +1 -3
- package/{components → src/components}/AuthingGuard/style.less +5 -0
- package/{components → src/components}/AuthingGuard/types/Forms.ts +2 -1
- package/{components → src/components}/AuthingGuard/types/GuardConfig.ts +5 -1
- package/{components → src/components}/AuthingGuard/types/GuardState.ts +1 -1
- package/{components → src/components}/AuthingGuard/types/Locales.ts +0 -0
- package/{components → src/components}/AuthingGuard/types/index.ts +0 -0
- package/src/components/index.ts +7 -0
- package/{components → src}/context/base.tsx +0 -0
- package/{components → src}/context/global/context.tsx +0 -0
- package/{components → src}/context/global/reducer.tsx +2 -2
- package/src/index.tsx +142 -0
- package/{logo.svg → src/logo.svg} +0 -0
- package/{react-app-env.d.ts → src/react-app-env.d.ts} +0 -0
- package/{reportWebVitals.ts → src/reportWebVitals.ts} +0 -0
- package/{setupTests.ts → src/setupTests.ts} +0 -0
- package/{components/_utils → src/utils}/clipboard.ts +1 -1
- package/{components/_utils → src/utils}/index.ts +3 -149
- package/{components/_utils → src/utils}/popupCenter.ts +0 -0
- package/tsconfig.json +2 -8
- package/build/asset-manifest.json +0 -26
- package/build/favicon.ico +0 -0
- package/build/index.html +0 -1
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/build/static/css/2.51c07e65.chunk.css +0 -3
- package/build/static/css/2.51c07e65.chunk.css.map +0 -1
- package/build/static/css/main.779f221a.chunk.css +0 -2
- package/build/static/css/main.779f221a.chunk.css.map +0 -1
- package/build/static/js/2.bbae9fdb.chunk.js +0 -3
- package/build/static/js/2.bbae9fdb.chunk.js.LICENSE.txt +0 -102
- package/build/static/js/2.bbae9fdb.chunk.js.map +0 -1
- package/build/static/js/3.fd17f196.chunk.js +0 -2
- package/build/static/js/3.fd17f196.chunk.js.map +0 -1
- package/build/static/js/main.5f341531.chunk.js +0 -2
- package/build/static/js/main.5f341531.chunk.js.map +0 -1
- package/build/static/js/runtime-main.ef138021.js +0 -2
- package/build/static/js/runtime-main.ef138021.js.map +0 -1
- package/build/static/media/loading.4a67a5f3.svg +0 -29
- package/components/BindTotp/core/bindSuccess.tsx +0 -72
- package/components/BindTotp/core/securityCode.tsx +0 -108
- package/components/BindTotp/index.tsx +0 -134
- package/components/BindTotp/interface.ts +0 -30
- package/components/BindTotp/styles.less +0 -57
- package/components/ChangeLanguage/index.tsx +0 -35
- package/components/ChangePassword/core/firstLoginReset.tsx +0 -111
- package/components/ChangePassword/core/rotateReset.tsx +0 -114
- package/components/ChangePassword/index.tsx +0 -72
- package/components/CompleteInfo/core/completeInfo.tsx +0 -155
- package/components/CompleteInfo/index.tsx +0 -45
- package/components/CompleteInfo/interface.ts +0 -40
- package/components/CompleteInfo/styles.less +0 -7
- package/components/DownloadAuthenticator/index.tsx +0 -97
- package/components/DownloadAuthenticator/interface.ts +0 -22
- package/components/DownloadAuthenticator/styles.less +0 -52
- package/components/Error/index.tsx +0 -21
- package/components/Error/interface.ts +0 -9
- package/components/Error/styles.less +0 -12
- package/components/ForgetPassword/core/resetPassword.tsx +0 -162
- package/components/ForgetPassword/index.tsx +0 -78
- package/components/ForgetPassword/interface.ts +0 -32
- package/components/Guard/Guard.tsx +0 -295
- package/components/Guard/authClient.ts +0 -44
- package/components/Guard/config.ts +0 -19
- package/components/Guard/event.ts +0 -52
- package/components/Guard/index.tsx +0 -4
- package/components/Guard/module.ts +0 -20
- package/components/Guard/stateMachine.ts +0 -152
- package/components/Guard/styles.less +0 -461
- package/components/IconFont/iconfont.js +0 -74
- package/components/IconFont/index.tsx +0 -16
- package/components/IconFont/style.less +0 -6
- package/components/IconFont/svg.js +0 -2
- package/components/ImagePro/index.tsx +0 -53
- package/components/ImagePro/styles.less +0 -40
- package/components/InputNumber/index.tsx +0 -33
- package/components/Login/codemap.ts +0 -49
- package/components/Login/core/withAD.tsx +0 -9
- package/components/Login/core/withAppQrcode.tsx +0 -49
- package/components/Login/core/withLDAP.tsx +0 -146
- package/components/Login/core/withPassword/FormItemAccount.tsx +0 -42
- package/components/Login/core/withPassword/GraphicVerifyCode.tsx +0 -30
- package/components/Login/core/withPassword/InputAccount.tsx +0 -64
- package/components/Login/core/withPassword/index.tsx +0 -173
- package/components/Login/core/withPhonecode.tsx +0 -122
- package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
- package/components/Login/core/withWechatmpQrcode.tsx +0 -53
- package/components/Login/index.tsx +0 -374
- package/components/Login/props.ts +0 -74
- package/components/Login/socialLogin/index.tsx +0 -407
- package/components/Login/socialLogin/style.less +0 -69
- package/components/Login/styles.less +0 -53
- package/components/MFA/VerifyCodeInput/VerifyCodeFormItem.tsx +0 -41
- package/components/MFA/VerifyCodeInput/index.tsx +0 -145
- package/components/MFA/VerifyCodeInput/style.less +0 -35
- package/components/MFA/codemap.ts +0 -24
- package/components/MFA/core/email.tsx +0 -203
- package/components/MFA/core/face.tsx +0 -297
- package/components/MFA/core/face_deps.tsx +0 -37
- package/components/MFA/core/sms.tsx +0 -203
- package/components/MFA/core/totp.tsx +0 -122
- package/components/MFA/index.tsx +0 -143
- package/components/MFA/mfaMethods/index.tsx +0 -88
- package/components/MFA/mfaMethods/style.less +0 -39
- package/components/MFA/props.ts +0 -51
- package/components/MFA/styles.less +0 -100
- package/components/NeedHelpView/core/describeQuestions.tsx +0 -245
- package/components/NeedHelpView/index.tsx +0 -47
- package/components/RecoveryCode/core/useCode.tsx +0 -71
- package/components/RecoveryCode/index.tsx +0 -27
- package/components/RecoveryCode/interface.ts +0 -31
- package/components/RecoveryCode/style.less +0 -13
- package/components/Register/codemap.ts +0 -12
- package/components/Register/components/Agreements/index.tsx +0 -81
- package/components/Register/components/Agreements/style.less +0 -44
- package/components/Register/core/WithEmail.tsx +0 -242
- package/components/Register/core/WithPhone.tsx +0 -184
- package/components/Register/index.tsx +0 -139
- package/components/Register/props.ts +0 -50
- package/components/SendCode/SendCodeBtn.tsx +0 -96
- package/components/SendCode/index.tsx +0 -94
- package/components/SendCode/style.less +0 -31
- package/components/ShieldSpin/index.tsx +0 -27
- package/components/ShieldSpin/loading.svg +0 -29
- package/components/SubmitButton/index.tsx +0 -50
- package/components/SubmitSuccess/index.tsx +0 -66
- package/components/SubmitSuccess/interface.ts +0 -17
- package/components/Type/index.ts +0 -52
- package/components/ValidatorRules/ValidatorFormItem.tsx +0 -139
- package/components/ValidatorRules/index.ts +0 -20
- package/components/_utils/GuardErrorCode.ts +0 -9
- package/components/_utils/config.ts +0 -116
- package/components/_utils/guradHttp.ts +0 -101
- package/components/_utils/hooks/index.ts +0 -64
- package/components/assets/images/error.png +0 -0
- package/components/context/module/context.tsx +0 -23
- package/components/index.ts +0 -12
- package/examples.tsx +0 -87
- package/index.js +0 -1
- package/lib/static/media/loading.4a67a5f3.svg +0 -29
- package/scripts/publish.js +0 -57
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
|
-
import { Form, Input } from 'antd'
|
|
4
|
-
|
|
5
|
-
import { LockOutlined } from '@ant-design/icons'
|
|
6
|
-
|
|
7
|
-
import { getPasswordValidate } from '../../_utils'
|
|
8
|
-
import SubmitButton from '../../SubmitButton'
|
|
9
|
-
|
|
10
|
-
interface RotateResetProps {
|
|
11
|
-
onReset: any
|
|
12
|
-
publicConfig: any
|
|
13
|
-
initData: any
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const RotateReset = (props: RotateResetProps) => {
|
|
17
|
-
const { t } = useTranslation()
|
|
18
|
-
let [form] = Form.useForm()
|
|
19
|
-
// let client = useAuthClient()
|
|
20
|
-
let submitButtonRef = useRef<any>(null)
|
|
21
|
-
|
|
22
|
-
const onFinish = async (values: any) => {
|
|
23
|
-
// let newPassword = values.password
|
|
24
|
-
// let res = await client.resetPasswordByFirstLoginToken({
|
|
25
|
-
// token: props.initData.token,
|
|
26
|
-
// password: newPassword,
|
|
27
|
-
// })
|
|
28
|
-
// props.onReset(res)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div className="authing-g2-login-phone-code">
|
|
33
|
-
<Form
|
|
34
|
-
name="resetPassword"
|
|
35
|
-
form={form}
|
|
36
|
-
onFinish={onFinish}
|
|
37
|
-
onFinishFailed={() => {
|
|
38
|
-
submitButtonRef?.current?.onError()
|
|
39
|
-
}}
|
|
40
|
-
autoComplete="off"
|
|
41
|
-
>
|
|
42
|
-
<Form.Item
|
|
43
|
-
className="authing-g2-input-form"
|
|
44
|
-
name="oldPassword"
|
|
45
|
-
rules={[{ required: true }]}
|
|
46
|
-
>
|
|
47
|
-
<Input.Password
|
|
48
|
-
className="authing-g2-input"
|
|
49
|
-
size="large"
|
|
50
|
-
placeholder={t('user.inputCurrPwd')}
|
|
51
|
-
prefix={<LockOutlined style={{ color: '#878A95' }} />}
|
|
52
|
-
/>
|
|
53
|
-
</Form.Item>
|
|
54
|
-
<Form.Item
|
|
55
|
-
className="authing-g2-input-form"
|
|
56
|
-
name="password"
|
|
57
|
-
rules={[
|
|
58
|
-
{
|
|
59
|
-
validator(_, value) {
|
|
60
|
-
if (value && value.indexOf(' ') !== -1) {
|
|
61
|
-
return Promise.reject(t('common.checkPasswordHasSpace'))
|
|
62
|
-
}
|
|
63
|
-
return Promise.resolve()
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
...getPasswordValidate(
|
|
67
|
-
props.publicConfig?.passwordStrength,
|
|
68
|
-
props.publicConfig?.customPasswordStrength
|
|
69
|
-
),
|
|
70
|
-
]}
|
|
71
|
-
>
|
|
72
|
-
<Input.Password
|
|
73
|
-
className="authing-g2-input"
|
|
74
|
-
size="large"
|
|
75
|
-
placeholder={t('login.inputPwd')}
|
|
76
|
-
prefix={<LockOutlined style={{ color: '#878A95' }} />}
|
|
77
|
-
/>
|
|
78
|
-
</Form.Item>
|
|
79
|
-
<Form.Item
|
|
80
|
-
className="authing-g2-input-form"
|
|
81
|
-
name="password2"
|
|
82
|
-
rules={[
|
|
83
|
-
{
|
|
84
|
-
validator(_, value) {
|
|
85
|
-
let pwd = form.getFieldValue('password')
|
|
86
|
-
if (!value) {
|
|
87
|
-
return Promise.reject(t('login.inputPwd'))
|
|
88
|
-
}
|
|
89
|
-
if (value !== pwd) {
|
|
90
|
-
return Promise.reject(t('common.repeatPasswordDoc'))
|
|
91
|
-
}
|
|
92
|
-
return Promise.resolve()
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
]}
|
|
96
|
-
>
|
|
97
|
-
<Input.Password
|
|
98
|
-
className="authing-g2-input"
|
|
99
|
-
size="large"
|
|
100
|
-
placeholder={t('login.inputPwdAgain')}
|
|
101
|
-
prefix={<LockOutlined style={{ color: '#878A95' }} />}
|
|
102
|
-
/>
|
|
103
|
-
</Form.Item>
|
|
104
|
-
<Form.Item className="authing-g2-input-form submit-form">
|
|
105
|
-
<SubmitButton
|
|
106
|
-
className="forget-password"
|
|
107
|
-
text={t('common.confirm')}
|
|
108
|
-
ref={submitButtonRef}
|
|
109
|
-
/>
|
|
110
|
-
</Form.Item>
|
|
111
|
-
</Form>
|
|
112
|
-
</div>
|
|
113
|
-
)
|
|
114
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
|
-
import { GuardModuleType } from '../Guard/module'
|
|
4
|
-
import { ImagePro } from '../ImagePro'
|
|
5
|
-
import { FirstLoginReset } from './core/firstLoginReset'
|
|
6
|
-
import { RotateReset } from './core/rotateReset'
|
|
7
|
-
|
|
8
|
-
// 手动修改密码,并非「忘记密码」
|
|
9
|
-
// 进入的场景是读取配置:1开了首次登录修改密码 || 2开了密码轮换
|
|
10
|
-
export const GuardChangePassword = (props: any) => {
|
|
11
|
-
let { initData, config } = props
|
|
12
|
-
let publicConfig = config.__publicConfig__
|
|
13
|
-
const { t } = useTranslation()
|
|
14
|
-
|
|
15
|
-
const onReset = (res: any) => {
|
|
16
|
-
let code = res.code
|
|
17
|
-
if (code === 200) {
|
|
18
|
-
// 返回登录
|
|
19
|
-
props.__changeModule(GuardModuleType.LOGIN)
|
|
20
|
-
} else {
|
|
21
|
-
console.log('*** reset code no catched', res)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const typeContent = useMemo(() => {
|
|
26
|
-
if (initData.type === 'inital') {
|
|
27
|
-
return {
|
|
28
|
-
title: `${t('common.welcome')} ${config.title}`,
|
|
29
|
-
explain: t('common.initPasswordText'),
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
return {
|
|
33
|
-
title: t('user.modifyPwd'),
|
|
34
|
-
explain: t('user.modifyPwdText', {
|
|
35
|
-
number: 1,
|
|
36
|
-
}),
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}, [config.title, initData.type, t])
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<div className="g2-view-container">
|
|
43
|
-
<div className="g2-view-header">
|
|
44
|
-
<ImagePro
|
|
45
|
-
src={config?.logo}
|
|
46
|
-
size={48}
|
|
47
|
-
borderRadius={4}
|
|
48
|
-
alt=""
|
|
49
|
-
className="icon"
|
|
50
|
-
/>
|
|
51
|
-
<div className="title">{typeContent.title}</div>
|
|
52
|
-
<div className="title-explain">{typeContent.explain}</div>
|
|
53
|
-
</div>
|
|
54
|
-
<div className="g2-view-tabs">
|
|
55
|
-
{initData.type === 'inital' && (
|
|
56
|
-
<FirstLoginReset
|
|
57
|
-
onReset={onReset}
|
|
58
|
-
initData={initData}
|
|
59
|
-
publicConfig={publicConfig}
|
|
60
|
-
/>
|
|
61
|
-
)}
|
|
62
|
-
{initData.type === 'rotate' && (
|
|
63
|
-
<RotateReset
|
|
64
|
-
onReset={onReset}
|
|
65
|
-
initData={initData}
|
|
66
|
-
publicConfig={publicConfig}
|
|
67
|
-
/>
|
|
68
|
-
)}
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { Form, Input, message, Select } from 'antd'
|
|
3
|
-
import { useTranslation } from 'react-i18next'
|
|
4
|
-
import { useAsyncFn } from 'react-use'
|
|
5
|
-
import { ExtendsField } from '../../AuthingGuard/api'
|
|
6
|
-
import { UploadImage } from '../../AuthingGuard/Forms/UploadImage'
|
|
7
|
-
import { useAuthClient } from '../../Guard/authClient'
|
|
8
|
-
import { i18n } from '../../_utils/locales'
|
|
9
|
-
import { useGuardHttp } from '../../_utils/guradHttp'
|
|
10
|
-
import { GuardCompleteInfoViewProps } from '../interface'
|
|
11
|
-
import SubmitButton from '../../SubmitButton'
|
|
12
|
-
|
|
13
|
-
export interface CompleteInfoProps {
|
|
14
|
-
extendsFields: ExtendsField[]
|
|
15
|
-
onRegisterInfoCompleted?: GuardCompleteInfoViewProps['onRegisterInfoCompleted']
|
|
16
|
-
onRegisterInfoCompletedError?: GuardCompleteInfoViewProps['onRegisterInfoCompletedError']
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const CompleteInfo: React.FC<CompleteInfoProps> = ({
|
|
20
|
-
extendsFields,
|
|
21
|
-
onRegisterInfoCompleted,
|
|
22
|
-
onRegisterInfoCompletedError,
|
|
23
|
-
}) => {
|
|
24
|
-
const authClient = useAuthClient()
|
|
25
|
-
const submitButtonRef = useRef<any>(null)
|
|
26
|
-
const { get, post } = useGuardHttp()
|
|
27
|
-
const { t } = useTranslation()
|
|
28
|
-
const [form] = Form.useForm()
|
|
29
|
-
|
|
30
|
-
const [definitions, setDefinitions] = useState<any[]>([])
|
|
31
|
-
|
|
32
|
-
const [, loadInitData] = useAsyncFn(async () => {
|
|
33
|
-
const user = await authClient.getCurrentUser()
|
|
34
|
-
|
|
35
|
-
const { data } = await get<any>('/api/v2/udfs/definitions', undefined, {
|
|
36
|
-
headers: {
|
|
37
|
-
authorization: user?.token!,
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
setDefinitions(data)
|
|
42
|
-
}, [authClient, get])
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
loadInitData()
|
|
46
|
-
}, [loadInitData])
|
|
47
|
-
|
|
48
|
-
const INPUT_MAP: Record<string, React.ReactNode | undefined> = {
|
|
49
|
-
image: <UploadImage />,
|
|
50
|
-
}
|
|
51
|
-
const INTERNAL_INPUT_MAP: Record<string, React.ReactNode | undefined> = {
|
|
52
|
-
gender: (
|
|
53
|
-
<Select
|
|
54
|
-
className="authing-g2-select"
|
|
55
|
-
options={[
|
|
56
|
-
{ label: i18n.t('common.man'), value: 'M' },
|
|
57
|
-
{ label: i18n.t('common.female'), value: 'F' },
|
|
58
|
-
]}
|
|
59
|
-
/>
|
|
60
|
-
),
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const formFields = extendsFields.map((def) => {
|
|
64
|
-
const key = `${def.type} ${def.type === 'internal' ? def.name : def.id}`
|
|
65
|
-
|
|
66
|
-
const label = i18n.language === 'zh-CN' ? def.label : def.name
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<Form.Item
|
|
70
|
-
key={key}
|
|
71
|
-
name={key}
|
|
72
|
-
label={label}
|
|
73
|
-
// style={{ marginBottom: 24 }}
|
|
74
|
-
className="authing-g2-input-form"
|
|
75
|
-
rules={[
|
|
76
|
-
{
|
|
77
|
-
required: true,
|
|
78
|
-
message: `${label} ${t('login.noEmpty')}`,
|
|
79
|
-
},
|
|
80
|
-
]}
|
|
81
|
-
>
|
|
82
|
-
{INTERNAL_INPUT_MAP[def.name] || INPUT_MAP[def.inputType] || (
|
|
83
|
-
<Input
|
|
84
|
-
type={def.inputType}
|
|
85
|
-
size="large"
|
|
86
|
-
className="authing-g2-input"
|
|
87
|
-
autoComplete="tel"
|
|
88
|
-
/>
|
|
89
|
-
)}
|
|
90
|
-
</Form.Item>
|
|
91
|
-
)
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
const [, onFinish] = useAsyncFn(async (values: any) => {
|
|
95
|
-
submitButtonRef.current?.onSpin(true)
|
|
96
|
-
|
|
97
|
-
const internalFields: any = {}
|
|
98
|
-
const userFields: any[] = []
|
|
99
|
-
Object.entries(values).forEach(([key, value]) => {
|
|
100
|
-
const [type, nameOrId] = key.split(' ')
|
|
101
|
-
if (type === 'internal') {
|
|
102
|
-
internalFields[nameOrId] = value
|
|
103
|
-
} else if (type === 'user') {
|
|
104
|
-
userFields.push({ nameOrId, value })
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
const udfs = userFields.map(({ nameOrId, value }) => ({
|
|
109
|
-
definition: definitions.find((def) => def.id === nameOrId),
|
|
110
|
-
value,
|
|
111
|
-
}))
|
|
112
|
-
|
|
113
|
-
try {
|
|
114
|
-
const user = await authClient.updateProfile(internalFields)
|
|
115
|
-
|
|
116
|
-
await post(
|
|
117
|
-
`/api/v2/udfs/values`,
|
|
118
|
-
{
|
|
119
|
-
udfs,
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
headers: {
|
|
123
|
-
authorization: user?.token,
|
|
124
|
-
},
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
submitButtonRef.current?.onSpin(false)
|
|
128
|
-
message.success(t('common.saveSuccess'))
|
|
129
|
-
onRegisterInfoCompleted?.(user, udfs, authClient)
|
|
130
|
-
} catch (e) {
|
|
131
|
-
// TODO
|
|
132
|
-
submitButtonRef.current?.onSpin(false)
|
|
133
|
-
onRegisterInfoCompletedError?.(e, udfs, authClient)
|
|
134
|
-
}
|
|
135
|
-
}, [])
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
<Form
|
|
139
|
-
layout="vertical"
|
|
140
|
-
form={form}
|
|
141
|
-
onFinish={onFinish}
|
|
142
|
-
onFinishFailed={() => submitButtonRef.current.onError()}
|
|
143
|
-
>
|
|
144
|
-
{formFields}
|
|
145
|
-
|
|
146
|
-
<Form.Item className="authing-g2-input-form">
|
|
147
|
-
<SubmitButton
|
|
148
|
-
text={t('common.problem.form.submit')}
|
|
149
|
-
ref={submitButtonRef}
|
|
150
|
-
className="password g2-completeInfo-submit"
|
|
151
|
-
/>
|
|
152
|
-
</Form.Item>
|
|
153
|
-
</Form>
|
|
154
|
-
)
|
|
155
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
|
-
import { ImagePro } from '../ImagePro'
|
|
4
|
-
import { GuardModuleType } from '../Guard/module'
|
|
5
|
-
|
|
6
|
-
import { CompleteInfo } from './core/completeInfo'
|
|
7
|
-
import { GuardCompleteInfoViewProps } from './interface'
|
|
8
|
-
|
|
9
|
-
import './styles.less'
|
|
10
|
-
|
|
11
|
-
export const GuardCompleteInfoView: React.FC<GuardCompleteInfoViewProps> = ({
|
|
12
|
-
config,
|
|
13
|
-
onRegisterInfoCompleted,
|
|
14
|
-
onRegisterInfoCompletedError,
|
|
15
|
-
__changeModule,
|
|
16
|
-
}) => {
|
|
17
|
-
const { t } = useTranslation()
|
|
18
|
-
return (
|
|
19
|
-
<div className="g2-view-container">
|
|
20
|
-
<div className="g2-view-header">
|
|
21
|
-
<ImagePro
|
|
22
|
-
src={config?.logo}
|
|
23
|
-
size={48}
|
|
24
|
-
borderRadius={4}
|
|
25
|
-
alt=""
|
|
26
|
-
className="icon"
|
|
27
|
-
/>
|
|
28
|
-
<div className="title">{t('common.perfectUserInfo')}</div>
|
|
29
|
-
<div className="title-explain">
|
|
30
|
-
{t('common.welcomeDoc', { name: config.title })}
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
<div className="g2-view-tabs g2-completeInfo-content">
|
|
34
|
-
<CompleteInfo
|
|
35
|
-
extendsFields={config?.__publicConfig__?.extendsFields!}
|
|
36
|
-
onRegisterInfoCompleted={(user, udfs, authClient) => {
|
|
37
|
-
onRegisterInfoCompleted?.(user, udfs, authClient)
|
|
38
|
-
__changeModule?.(GuardModuleType.LOGIN, {})
|
|
39
|
-
}}
|
|
40
|
-
onRegisterInfoCompletedError={onRegisterInfoCompletedError}
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { AuthenticationClient, CommonMessage, User } from 'authing-js-sdk'
|
|
2
|
-
import { getDefaultG2Config, IG2Config, IG2Events, IG2FCProps } from '../Type'
|
|
3
|
-
|
|
4
|
-
export interface CompleteInfoConfig extends IG2Config {}
|
|
5
|
-
|
|
6
|
-
const defaultConfig: CompleteInfoConfig = {
|
|
7
|
-
...getDefaultG2Config(),
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const getDefaultLoginConfig = (): CompleteInfoConfig => ({
|
|
11
|
-
...getDefaultG2Config(),
|
|
12
|
-
...defaultConfig,
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
export interface CompleteInfoEvents extends IG2Events {
|
|
16
|
-
onRegisterInfoCompleted?: (
|
|
17
|
-
user: User,
|
|
18
|
-
udfs: {
|
|
19
|
-
definition: any
|
|
20
|
-
value: any
|
|
21
|
-
}[],
|
|
22
|
-
authClient: AuthenticationClient
|
|
23
|
-
) => void
|
|
24
|
-
onRegisterInfoCompletedError?: (
|
|
25
|
-
error: CommonMessage,
|
|
26
|
-
udfs: {
|
|
27
|
-
definition: any
|
|
28
|
-
value: any
|
|
29
|
-
}[],
|
|
30
|
-
authClient: AuthenticationClient
|
|
31
|
-
) => void
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface GuardCompleteInfoProps extends IG2FCProps, CompleteInfoEvents {
|
|
35
|
-
config: Partial<CompleteInfoConfig>
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface GuardCompleteInfoViewProps extends GuardCompleteInfoProps {
|
|
39
|
-
config: CompleteInfoConfig
|
|
40
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { Tabs } from 'antd'
|
|
2
|
-
import React, { ReactNode, useMemo } from 'react'
|
|
3
|
-
import { useTranslation } from 'react-i18next'
|
|
4
|
-
import { ImagePro } from '../ImagePro'
|
|
5
|
-
import { IconFont } from '../IconFont'
|
|
6
|
-
import { GuardDownloadATViewProps } from './interface'
|
|
7
|
-
import './styles.less'
|
|
8
|
-
const window: Window = require('global/window')
|
|
9
|
-
|
|
10
|
-
enum DownloadType {
|
|
11
|
-
IOS = 'ios',
|
|
12
|
-
Android = 'Android',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const GuardDownloadATView: React.FC<GuardDownloadATViewProps> = ({
|
|
16
|
-
config,
|
|
17
|
-
}) => {
|
|
18
|
-
const { t } = useTranslation()
|
|
19
|
-
|
|
20
|
-
const cdnBase = config.__publicConfig__?.cdnBase
|
|
21
|
-
|
|
22
|
-
const downloadConfig: Record<DownloadType, any> = useMemo(
|
|
23
|
-
() => ({
|
|
24
|
-
[DownloadType.IOS]: {
|
|
25
|
-
title: t('common.downloadTotpAppIOS'),
|
|
26
|
-
google: `${cdnBase}/GoogleAuthenticator-Apple.png`,
|
|
27
|
-
microsoft: `${cdnBase}/MicrosoftAuthenticator-Apple.png`,
|
|
28
|
-
},
|
|
29
|
-
[DownloadType.Android]: {
|
|
30
|
-
title: t('common.downloadTotpAppAndroid'),
|
|
31
|
-
google: `${cdnBase}/GoogleAuthenticator-Authing.png`,
|
|
32
|
-
microsoft: `${cdnBase}/MicrosoftAuthenticator-Baidu.png`,
|
|
33
|
-
},
|
|
34
|
-
}),
|
|
35
|
-
[cdnBase, t]
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
const renderTab = useMemo(
|
|
39
|
-
() =>
|
|
40
|
-
(Object.keys(downloadConfig) as DownloadType[]).map<ReactNode>(
|
|
41
|
-
(value: DownloadType, index: number) => (
|
|
42
|
-
<Tabs.TabPane
|
|
43
|
-
tab={downloadConfig[value].title}
|
|
44
|
-
key={index}
|
|
45
|
-
className="g2-mfa-download-at-tab"
|
|
46
|
-
>
|
|
47
|
-
<span className="g2-mfa-totp-download-subtitle">
|
|
48
|
-
{t('common.downloadTotpAppDocs')}
|
|
49
|
-
</span>
|
|
50
|
-
<div className="g2-mfa-totp-download-qrcode">
|
|
51
|
-
<div className="g2-mfa-totp-download-qrcode-item">
|
|
52
|
-
<ImagePro
|
|
53
|
-
width={120}
|
|
54
|
-
height={120}
|
|
55
|
-
className="g2-mfa-totp-download-image"
|
|
56
|
-
src={downloadConfig[value].google}
|
|
57
|
-
alt="Google Authenticator"
|
|
58
|
-
/>
|
|
59
|
-
<span className="g2-mfa-totp-download-qrcode-text">
|
|
60
|
-
Google Authenticator
|
|
61
|
-
</span>
|
|
62
|
-
</div>
|
|
63
|
-
<div className="g2-mfa-totp-download-qrcode-item">
|
|
64
|
-
<ImagePro
|
|
65
|
-
width={120}
|
|
66
|
-
height={120}
|
|
67
|
-
className="g2-mfa-totp-download-image"
|
|
68
|
-
src={downloadConfig[value].microsoft}
|
|
69
|
-
alt="Microsoft Authenticator"
|
|
70
|
-
/>
|
|
71
|
-
<span className="g2-mfa-totp-download-qrcode-text">
|
|
72
|
-
Microsoft Authenticator
|
|
73
|
-
</span>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</Tabs.TabPane>
|
|
77
|
-
)
|
|
78
|
-
),
|
|
79
|
-
[downloadConfig, t]
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
const onBack = () => window.history.back()
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<div className="g2-view-container">
|
|
86
|
-
<div className="g2-view-back">
|
|
87
|
-
<span onClick={onBack}>
|
|
88
|
-
<IconFont type="authing-back" />
|
|
89
|
-
<span>{t('common.backToMFA')}</span>
|
|
90
|
-
</span>
|
|
91
|
-
</div>
|
|
92
|
-
<div className="g2-view-tabs g2-mfa-totp-download-tabs">
|
|
93
|
-
<Tabs defaultActiveKey={DownloadType.IOS}>{renderTab}</Tabs>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getDefaultG2Config, IG2Config, IG2Events, IG2FCProps } from '../Type'
|
|
2
|
-
|
|
3
|
-
export interface DownloadATConfig extends IG2Config {}
|
|
4
|
-
|
|
5
|
-
const defaultConfig: DownloadATConfig = {
|
|
6
|
-
...getDefaultG2Config(),
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const getDefaultDownloadAuthenticatorConfig = (): DownloadATConfig => ({
|
|
10
|
-
...getDefaultG2Config(),
|
|
11
|
-
...defaultConfig,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
export interface DownloadATEvents extends IG2Events {}
|
|
15
|
-
|
|
16
|
-
export interface GuardDownloadATProps extends IG2FCProps, DownloadATEvents {
|
|
17
|
-
config: Partial<DownloadATConfig>
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface GuardDownloadATViewProps extends GuardDownloadATProps {
|
|
21
|
-
config: DownloadATConfig
|
|
22
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
.g2-view-container-totp-dl {
|
|
2
|
-
width: 900px;
|
|
3
|
-
padding: 0;
|
|
4
|
-
}
|
|
5
|
-
.g2-mfa-totp-title {
|
|
6
|
-
width: 100%;
|
|
7
|
-
height: 54px;
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
font-size: 16px;
|
|
12
|
-
color: #293350;
|
|
13
|
-
border-bottom: 1px solid #eaebee;
|
|
14
|
-
margin-bottom: 54px;
|
|
15
|
-
}
|
|
16
|
-
.g2-mfa-totp-download-tabs {
|
|
17
|
-
margin-top: 30px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.g2-mfa-download-at-tab {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
align-items: center;
|
|
24
|
-
margin-top: 15px;
|
|
25
|
-
|
|
26
|
-
.g2-mfa-totp-download-subtitle {
|
|
27
|
-
color: #545968;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.g2-mfa-totp-download-qrcode-item {
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
align-items: center;
|
|
34
|
-
|
|
35
|
-
margin-top: 35px;
|
|
36
|
-
|
|
37
|
-
.g2-mfa-totp-download-image {
|
|
38
|
-
width: 130px;
|
|
39
|
-
height: 130px;
|
|
40
|
-
display: flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
box-shadow: 0px 0px 30px rgba(84, 89, 104, 0.15);
|
|
44
|
-
border-radius: 4px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.g2-mfa-totp-download-qrcode-text {
|
|
48
|
-
margin-top: 8px;
|
|
49
|
-
color: #545968;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ImagePro } from '../ImagePro'
|
|
3
|
-
import { GuardErrorViewProps } from './interface'
|
|
4
|
-
|
|
5
|
-
import './styles.less'
|
|
6
|
-
|
|
7
|
-
export const GuardErrorView: React.FC<GuardErrorViewProps> = (props) => {
|
|
8
|
-
const messages = props?.initData?.messages
|
|
9
|
-
? `出错了~:${props?.initData?.messages} `
|
|
10
|
-
: `未知的错误~ 请您联系管理员进行处理`
|
|
11
|
-
const imgSrc = require('../assets/images/error.png').default
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div className="g2-view-container">
|
|
15
|
-
<div className="g2-error-content">
|
|
16
|
-
<ImagePro width={240} height={162} src={imgSrc} alt="guard error img" />
|
|
17
|
-
<span>{messages}</span>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
)
|
|
21
|
-
}
|