@authing/react-ui-components 3.0.2-beta.7 → 3.0.3-rc.4
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/lib/index.d.ts +4263 -0
- package/lib/index.min.css +2 -0
- package/lib/index.min.js +2 -0
- package/{build/static/js/2.142555a1.chunk.js.LICENSE.txt → lib/index.min.js.LICENSE.txt} +8 -31
- package/{build → lib}/static/media/loading.4a67a5f3.svg +0 -0
- package/package.json +35 -12
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -7
- package/.prettierrc +0 -5
- 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.5c23c9b8.chunk.css +0 -3
- package/build/static/css/2.5c23c9b8.chunk.css.map +0 -1
- package/build/static/css/main.6a8701e8.chunk.css +0 -2
- package/build/static/css/main.6a8701e8.chunk.css.map +0 -1
- package/build/static/js/2.142555a1.chunk.js +0 -3
- package/build/static/js/2.142555a1.chunk.js.map +0 -1
- package/build/static/js/3.ed27e06b.chunk.js +0 -2
- package/build/static/js/3.ed27e06b.chunk.js.map +0 -1
- package/build/static/js/main.8d075e4d.chunk.js +0 -2
- package/build/static/js/main.8d075e4d.chunk.js.map +0 -1
- package/build/static/js/runtime-main.9a428724.js +0 -2
- package/build/static/js/runtime-main.9a428724.js.map +0 -1
- package/components/AuthingDropdown/index.tsx +0 -52
- package/components/AuthingDropdown/style.less +0 -43
- package/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
- package/components/AuthingGuard/AppMFALayout/style.less +0 -12
- package/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
- package/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
- package/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
- package/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
- package/components/AuthingGuard/Forms/Agreements/style.less +0 -44
- package/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
- package/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -84
- package/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
- package/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
- package/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
- package/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
- package/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
- package/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -166
- package/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
- package/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
- package/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
- package/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
- package/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
- package/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
- package/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
- package/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
- package/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
- package/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
- package/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
- package/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
- package/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -59
- package/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
- package/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
- package/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
- package/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
- package/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
- package/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
- package/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
- package/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
- package/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
- package/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
- package/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
- package/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
- package/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
- package/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
- package/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
- package/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
- package/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
- package/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
- package/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
- package/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
- package/components/AuthingGuard/Forms/index.ts +0 -13
- package/components/AuthingGuard/GuardLayout/index.tsx +0 -474
- package/components/AuthingGuard/GuardLayout/style.less +0 -111
- package/components/AuthingGuard/Header/index.tsx +0 -25
- package/components/AuthingGuard/Header/style.less +0 -52
- package/components/AuthingGuard/IconFont/iconfont.js +0 -74
- package/components/AuthingGuard/IconFont/index.tsx +0 -19
- package/components/AuthingGuard/IconFont/style.less +0 -6
- package/components/AuthingGuard/IconFont/svg.js +0 -2
- package/components/AuthingGuard/LoginLayout/index.tsx +0 -161
- package/components/AuthingGuard/LoginLayout/style.less +0 -0
- package/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
- package/components/AuthingGuard/MfaLayout/index.tsx +0 -49
- package/components/AuthingGuard/MfaLayout/style.less +0 -3
- package/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
- package/components/AuthingGuard/RegisterLayout/style.less +0 -0
- package/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
- package/components/AuthingGuard/ToggleLang/index.tsx +0 -51
- package/components/AuthingGuard/api/appConfig.ts +0 -146
- package/components/AuthingGuard/api/index.ts +0 -3
- package/components/AuthingGuard/api/sso.ts +0 -29
- package/components/AuthingGuard/api/userPoolConfig.ts +0 -111
- package/components/AuthingGuard/constants.ts +0 -107
- package/components/AuthingGuard/hooks/index.tsx +0 -70
- package/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
- package/components/AuthingGuard/index.tsx +0 -126
- package/components/AuthingGuard/style.less +0 -103
- package/components/AuthingGuard/types/Forms.ts +0 -94
- package/components/AuthingGuard/types/GuardConfig.ts +0 -420
- package/components/AuthingGuard/types/GuardState.ts +0 -7
- package/components/AuthingGuard/types/Locales.ts +0 -12
- package/components/AuthingGuard/types/index.ts +0 -4
- package/components/AuthingTabs/index.tsx +0 -98
- package/components/AuthingTabs/style.less +0 -135
- 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 -125
- 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/CopyAbleText/index.tsx +0 -54
- package/components/CopyAbleText/style.less +0 -13
- 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/interface.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/interface.ts +0 -51
- package/components/MFA/mfaMethods/index.tsx +0 -88
- package/components/MFA/mfaMethods/style.less +0 -39
- 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/interface.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/VerifyCodeInput/index.tsx +0 -76
- package/components/VerifyCodeInput/style.less +0 -24
- package/components/_utils/GuardErrorCode.ts +0 -9
- package/components/_utils/clipboard.ts +0 -27
- package/components/_utils/config.ts +0 -116
- package/components/_utils/guradHttp.ts +0 -101
- package/components/_utils/hooks/index.ts +0 -64
- package/components/_utils/http.ts +0 -85
- package/components/_utils/index.ts +0 -326
- package/components/_utils/locales/en/common.json +0 -229
- package/components/_utils/locales/en/index.ts +0 -6
- package/components/_utils/locales/en/login.json +0 -96
- package/components/_utils/locales/en/map.json +0 -4
- package/components/_utils/locales/en/user.json +0 -82
- package/components/_utils/locales/index.ts +0 -45
- package/components/_utils/locales/zh/common.json +0 -229
- package/components/_utils/locales/zh/index.ts +0 -6
- package/components/_utils/locales/zh/login.json +0 -96
- package/components/_utils/locales/zh/map.json +0 -4
- package/components/_utils/locales/zh/user.json +0 -83
- package/components/_utils/popupCenter.ts +0 -48
- package/components/assets/images/error.png +0 -0
- package/components/context/base.tsx +0 -28
- package/components/context/global/context.tsx +0 -39
- package/components/context/global/reducer.tsx +0 -56
- package/components/context/module/context.tsx +0 -23
- package/components/index.ts +0 -9
- package/config/antdReplacer.js +0 -51
- package/config/env.js +0 -104
- package/config/getHttpsConfig.js +0 -66
- package/config/jest/cssTransform.js +0 -14
- package/config/jest/fileTransform.js +0 -40
- package/config/modules.js +0 -134
- package/config/paths.js +0 -71
- package/config/pnpTs.js +0 -35
- package/config/webpack.config.js +0 -835
- package/config/webpackDevServer.config.js +0 -130
- package/examples.tsx +0 -87
- package/index.js +0 -1
- package/logo.svg +0 -7
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/react-app-env.d.ts +0 -71
- package/reportWebVitals.ts +0 -15
- package/scripts/build.js +0 -208
- package/scripts/lib.js +0 -200
- package/scripts/publish.js +0 -57
- package/scripts/start.js +0 -162
- package/scripts/test.js +0 -49
- package/setupTests.ts +0 -5
- package/tsconfig.json +0 -30
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Button } from 'antd'
|
|
2
|
-
import React, { FC, useMemo } from 'react'
|
|
3
|
-
import { EllipsisOutlined } from '@ant-design/icons'
|
|
4
|
-
|
|
5
|
-
import { getClassnames } from '../_utils'
|
|
6
|
-
|
|
7
|
-
import './style.less'
|
|
8
|
-
|
|
9
|
-
export interface AuthingTabsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
-
activeKey?: string
|
|
11
|
-
onTabClick: (key: string) => void
|
|
12
|
-
showLen?: number
|
|
13
|
-
tabs: {
|
|
14
|
-
key: string
|
|
15
|
-
label: string
|
|
16
|
-
component: JSX.Element
|
|
17
|
-
}[]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const AuthingTabs: FC<AuthingTabsProps> = ({
|
|
21
|
-
tabs,
|
|
22
|
-
showLen = 3,
|
|
23
|
-
className,
|
|
24
|
-
activeKey,
|
|
25
|
-
onTabClick,
|
|
26
|
-
}) => {
|
|
27
|
-
const activeIndex = useMemo(
|
|
28
|
-
() => tabs.findIndex((item) => item.key === activeKey),
|
|
29
|
-
[tabs, activeKey]
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
const showTabs = useMemo(() => {
|
|
33
|
-
if (tabs.length <= showLen) {
|
|
34
|
-
return [...tabs]
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let startIndex = Math.max(activeIndex - 1, 0)
|
|
38
|
-
if (startIndex + showLen > tabs.length - 1) {
|
|
39
|
-
startIndex = tabs.length - showLen
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return tabs.slice(startIndex, startIndex + showLen)
|
|
43
|
-
}, [showLen, activeIndex, tabs])
|
|
44
|
-
|
|
45
|
-
const hideTabs = useMemo(() => {
|
|
46
|
-
const showKeys = showTabs.map((item) => item.key)
|
|
47
|
-
return tabs.filter((item) => !showKeys.find((key) => item.key === key))
|
|
48
|
-
}, [tabs, showTabs])
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<>
|
|
52
|
-
<div className={getClassnames(['authing-tabs', className])}>
|
|
53
|
-
<div
|
|
54
|
-
className={getClassnames([
|
|
55
|
-
'authing-tabs-inner',
|
|
56
|
-
Boolean(hideTabs.length) && 'authing-tabs-inner--more',
|
|
57
|
-
])}
|
|
58
|
-
>
|
|
59
|
-
{showTabs.map((item, index) => (
|
|
60
|
-
<div
|
|
61
|
-
onClick={() => onTabClick(item.key)}
|
|
62
|
-
className={getClassnames([
|
|
63
|
-
'authing-tab-item',
|
|
64
|
-
activeKey === item.key && 'authing-tab-item__active',
|
|
65
|
-
])}
|
|
66
|
-
key={item.key}
|
|
67
|
-
>
|
|
68
|
-
{item.label}
|
|
69
|
-
</div>
|
|
70
|
-
))}
|
|
71
|
-
</div>
|
|
72
|
-
{Boolean(hideTabs.length) && (
|
|
73
|
-
<Button
|
|
74
|
-
className="authing-tabs-show-more"
|
|
75
|
-
type="text"
|
|
76
|
-
icon={<EllipsisOutlined />}
|
|
77
|
-
>
|
|
78
|
-
<ul className="authing-tabs-more-panel">
|
|
79
|
-
{hideTabs.map((item) => (
|
|
80
|
-
<li
|
|
81
|
-
key={item.key}
|
|
82
|
-
onClick={() => onTabClick(item.key)}
|
|
83
|
-
className="authing-tabs-more-panel-item"
|
|
84
|
-
>
|
|
85
|
-
{item.label}
|
|
86
|
-
</li>
|
|
87
|
-
))}
|
|
88
|
-
</ul>
|
|
89
|
-
</Button>
|
|
90
|
-
)}
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
<div className="authing-tab-pane">
|
|
94
|
-
{tabs.find((item) => item.key === activeKey)?.component}
|
|
95
|
-
</div>
|
|
96
|
-
</>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
.authing-tabs {
|
|
2
|
-
display: flex;
|
|
3
|
-
margin-bottom: 36px;
|
|
4
|
-
align-items: center;
|
|
5
|
-
}
|
|
6
|
-
.authing-tabs-inner {
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: space-around;
|
|
9
|
-
align-items: center;
|
|
10
|
-
flex: 1;
|
|
11
|
-
}
|
|
12
|
-
.authing-tabs-inner--more {
|
|
13
|
-
box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, 0.08);
|
|
14
|
-
}
|
|
15
|
-
.authing-tab-item {
|
|
16
|
-
color: #aeb9d4;
|
|
17
|
-
font-size: 16px;
|
|
18
|
-
transition: all 0.3s ease-in-out;
|
|
19
|
-
white-space: nowrap;
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
position: relative;
|
|
22
|
-
height: 28px;
|
|
23
|
-
margin-right: 32px;
|
|
24
|
-
&:last-child {
|
|
25
|
-
margin-right: 12px;
|
|
26
|
-
}
|
|
27
|
-
&:only-child {
|
|
28
|
-
margin-right: 0;
|
|
29
|
-
}
|
|
30
|
-
&::after {
|
|
31
|
-
content: '';
|
|
32
|
-
width: 0;
|
|
33
|
-
height: 2px;
|
|
34
|
-
display: block;
|
|
35
|
-
position: absolute;
|
|
36
|
-
left: 50%;
|
|
37
|
-
bottom: -4px;
|
|
38
|
-
transform: translateX(-50%);
|
|
39
|
-
background-color: transparent;
|
|
40
|
-
transition: all 0.3s ease-in-out;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
.authing-tab-item__active {
|
|
44
|
-
color: #396aff;
|
|
45
|
-
font-size: 18px;
|
|
46
|
-
&::after {
|
|
47
|
-
width: 26px;
|
|
48
|
-
background-color: #396aff;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
.authing-tabs-show-more {
|
|
52
|
-
position: relative;
|
|
53
|
-
z-index: 2;
|
|
54
|
-
&.ant-btn {
|
|
55
|
-
padding: 0 12px;
|
|
56
|
-
}
|
|
57
|
-
&:hover,
|
|
58
|
-
&:focus,
|
|
59
|
-
&:active {
|
|
60
|
-
background-color: #fff;
|
|
61
|
-
}
|
|
62
|
-
&:hover {
|
|
63
|
-
.authing-tabs-more-panel {
|
|
64
|
-
height: auto;
|
|
65
|
-
opacity: 1;
|
|
66
|
-
padding: 4px 0;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&:after {
|
|
71
|
-
content: '';
|
|
72
|
-
display: block;
|
|
73
|
-
width: 100%;
|
|
74
|
-
height: 6px;
|
|
75
|
-
top: 100%;
|
|
76
|
-
left: 0;
|
|
77
|
-
position: absolute;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
.authing-tabs-more-panel {
|
|
81
|
-
position: absolute;
|
|
82
|
-
box-sizing: border-box;
|
|
83
|
-
transition: all 0.3s;
|
|
84
|
-
height: 0;
|
|
85
|
-
opacity: 0;
|
|
86
|
-
right: 0;
|
|
87
|
-
top: 100%;
|
|
88
|
-
transform: translateY(6px);
|
|
89
|
-
background-color: #fff;
|
|
90
|
-
max-height: 200px;
|
|
91
|
-
margin: 0;
|
|
92
|
-
padding: 0;
|
|
93
|
-
overflow-x: hidden;
|
|
94
|
-
overflow-y: auto;
|
|
95
|
-
text-align: left;
|
|
96
|
-
list-style-type: none;
|
|
97
|
-
background-clip: padding-box;
|
|
98
|
-
border-radius: 2px;
|
|
99
|
-
outline: none;
|
|
100
|
-
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
101
|
-
0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
102
|
-
}
|
|
103
|
-
.authing-tabs-more-panel-item {
|
|
104
|
-
min-width: 120px;
|
|
105
|
-
margin: 0;
|
|
106
|
-
padding: 5px 12px;
|
|
107
|
-
overflow: hidden;
|
|
108
|
-
color: rgba(0, 0, 0, 0.85);
|
|
109
|
-
font-weight: 400;
|
|
110
|
-
font-size: 14px;
|
|
111
|
-
line-height: 22px;
|
|
112
|
-
white-space: nowrap;
|
|
113
|
-
text-overflow: ellipsis;
|
|
114
|
-
cursor: pointer;
|
|
115
|
-
transition: all 0.3s;
|
|
116
|
-
&:hover {
|
|
117
|
-
background-color: #f5f5f5;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@media only screen and (max-width: 719px) {
|
|
122
|
-
.authing-tabs-inner {
|
|
123
|
-
justify-content: flex-start;
|
|
124
|
-
}
|
|
125
|
-
.authing-tab-item {
|
|
126
|
-
margin-right: 40px;
|
|
127
|
-
font-size: 14px;
|
|
128
|
-
}
|
|
129
|
-
.authing-tab-item__active {
|
|
130
|
-
font-size: 16px;
|
|
131
|
-
}
|
|
132
|
-
.authing-tab-pane {
|
|
133
|
-
padding-bottom: 70px;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Form, Checkbox, Typography } from 'antd'
|
|
2
|
-
import React, { useRef } from 'react'
|
|
3
|
-
import { useTranslation } from 'react-i18next'
|
|
4
|
-
import SubmitButton from '../../SubmitButton'
|
|
5
|
-
|
|
6
|
-
const { Paragraph } = Typography
|
|
7
|
-
|
|
8
|
-
export interface BindSuccessProps {
|
|
9
|
-
onBind: any
|
|
10
|
-
secret: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const BindSuccess: React.FC<BindSuccessProps> = ({ secret, onBind }) => {
|
|
14
|
-
// const [isSaved, setIsSaved] = useState(false)
|
|
15
|
-
const submitButtonRef = useRef<any>(null)
|
|
16
|
-
const [form] = Form.useForm()
|
|
17
|
-
|
|
18
|
-
const { t } = useTranslation()
|
|
19
|
-
|
|
20
|
-
const bindSuccess = async () => {
|
|
21
|
-
submitButtonRef.current?.onSpin(true)
|
|
22
|
-
try {
|
|
23
|
-
await form.validateFields()
|
|
24
|
-
onBind()
|
|
25
|
-
} catch (e: any) {
|
|
26
|
-
submitButtonRef.current?.onError()
|
|
27
|
-
} finally {
|
|
28
|
-
submitButtonRef.current?.onSpin(false)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
<p className="authing-g2-mfa-title">{t('common.totpText1')}</p>
|
|
35
|
-
<p className="authing-g2-mfa-tips">{t('common.totpText2')}</p>
|
|
36
|
-
|
|
37
|
-
<div className="g2-mfa-bindTotp-copySecret">
|
|
38
|
-
<Paragraph copyable>{secret}</Paragraph>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<Form
|
|
42
|
-
form={form}
|
|
43
|
-
onFinish={bindSuccess}
|
|
44
|
-
style={{ width: '100%' }}
|
|
45
|
-
onFinishFailed={() => submitButtonRef.current?.onError()}
|
|
46
|
-
>
|
|
47
|
-
<Form.Item
|
|
48
|
-
className="authing-g2-input-form g2-mfa-totp-verify-input"
|
|
49
|
-
name="remember"
|
|
50
|
-
rules={[
|
|
51
|
-
{
|
|
52
|
-
validator: (_, value) => {
|
|
53
|
-
console.log(value)
|
|
54
|
-
if (!value) {
|
|
55
|
-
return Promise.reject(t('common.pleaseRecordKey'))
|
|
56
|
-
}
|
|
57
|
-
return Promise.resolve()
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
]}
|
|
61
|
-
valuePropName="checked"
|
|
62
|
-
>
|
|
63
|
-
<Checkbox className="g2-mfa-bindTotp-secretSave">
|
|
64
|
-
{t('login.rememberedSecret')}
|
|
65
|
-
</Checkbox>
|
|
66
|
-
</Form.Item>
|
|
67
|
-
|
|
68
|
-
<SubmitButton text={t('common.bindSuccess')} ref={submitButtonRef} />
|
|
69
|
-
</Form>
|
|
70
|
-
</>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { Form, message } from 'antd'
|
|
2
|
-
import React, { useRef } from 'react'
|
|
3
|
-
import { useTranslation } from 'react-i18next'
|
|
4
|
-
import { useAsyncFn } from 'react-use'
|
|
5
|
-
|
|
6
|
-
import { GuardModuleType } from '../../Guard/module'
|
|
7
|
-
import { useGuardHttp } from '../../_utils/guradHttp'
|
|
8
|
-
import SubmitButton from '../../SubmitButton'
|
|
9
|
-
import { ImagePro } from '../../ImagePro'
|
|
10
|
-
import { VerifyCodeFormItem } from '../../MFA/VerifyCodeInput/VerifyCodeFormItem'
|
|
11
|
-
import { VerifyCodeInput } from '../../MFA/VerifyCodeInput'
|
|
12
|
-
export interface SecurityCodeProps {
|
|
13
|
-
mfaToken: string
|
|
14
|
-
qrcode: string
|
|
15
|
-
onNext: any
|
|
16
|
-
changeModule: any
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const SecurityCode: React.FC<SecurityCodeProps> = ({
|
|
20
|
-
mfaToken,
|
|
21
|
-
qrcode,
|
|
22
|
-
onNext,
|
|
23
|
-
changeModule,
|
|
24
|
-
}) => {
|
|
25
|
-
const [form] = Form.useForm()
|
|
26
|
-
const submitButtonRef = useRef<any>(null)
|
|
27
|
-
|
|
28
|
-
const { t } = useTranslation()
|
|
29
|
-
|
|
30
|
-
const { post } = useGuardHttp()
|
|
31
|
-
|
|
32
|
-
const onJump = () => {
|
|
33
|
-
changeModule?.(GuardModuleType.DOWNLOAD_AT)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const [, bindTotp] = useAsyncFn(async () => {
|
|
37
|
-
submitButtonRef.current.onSpin(true)
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
await form.validateFields()
|
|
41
|
-
const saftyCode = form.getFieldValue('saftyCode')
|
|
42
|
-
|
|
43
|
-
const { code, data, message: resMessage } = await post(
|
|
44
|
-
'/api/v2/mfa/totp/associate/confirm',
|
|
45
|
-
{
|
|
46
|
-
authenticator_type: 'totp',
|
|
47
|
-
totp: saftyCode.join(''),
|
|
48
|
-
source: 'APPLICATION',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
headers: {
|
|
52
|
-
authorization: mfaToken,
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
if (code !== 200) {
|
|
58
|
-
submitButtonRef.current.onError()
|
|
59
|
-
message.error(resMessage)
|
|
60
|
-
} else {
|
|
61
|
-
onNext(data)
|
|
62
|
-
}
|
|
63
|
-
} catch (e: any) {
|
|
64
|
-
submitButtonRef.current.onError()
|
|
65
|
-
} finally {
|
|
66
|
-
submitButtonRef.current?.onSpin(false)
|
|
67
|
-
}
|
|
68
|
-
}, [mfaToken])
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<>
|
|
72
|
-
<p className="authing-g2-mfa-title">{t('user.mfaBind')}</p>
|
|
73
|
-
<p
|
|
74
|
-
className="authing-g2-mfa-tips"
|
|
75
|
-
style={{
|
|
76
|
-
textAlign: 'left',
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
{t('common.usePhoneOpen')} Google Authenticator or Microsoft
|
|
80
|
-
Authenticator({t('common.noValidator')}{' '}
|
|
81
|
-
<span
|
|
82
|
-
style={{
|
|
83
|
-
color: '#396AFF',
|
|
84
|
-
cursor: 'pointer',
|
|
85
|
-
}}
|
|
86
|
-
onClick={onJump}
|
|
87
|
-
>
|
|
88
|
-
{t('common.clickTodownload')}
|
|
89
|
-
</span>
|
|
90
|
-
) {t('common.mfaText1')}
|
|
91
|
-
</p>
|
|
92
|
-
<ImagePro className="g2-mfa-bindTotp-qrcode" src={qrcode} alt="qrcode" />
|
|
93
|
-
<Form
|
|
94
|
-
className="g2-mfa-bindTotp-securityCode-form"
|
|
95
|
-
form={form}
|
|
96
|
-
onSubmitCapture={() => {}}
|
|
97
|
-
onFinish={bindTotp}
|
|
98
|
-
onFinishFailed={() => submitButtonRef.current.onError()}
|
|
99
|
-
>
|
|
100
|
-
<VerifyCodeFormItem codeLength={6} name="saftyCode">
|
|
101
|
-
<VerifyCodeInput length={6} showDivider={true} gutter={'10px'} />
|
|
102
|
-
</VerifyCodeFormItem>
|
|
103
|
-
<p>{t('user.numberSafteyCode')}</p>
|
|
104
|
-
<SubmitButton text={t('user.nextStep')} ref={submitButtonRef} />
|
|
105
|
-
</Form>
|
|
106
|
-
</>
|
|
107
|
-
)
|
|
108
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { message } from 'antd'
|
|
2
|
-
import { User } from 'authing-js-sdk'
|
|
3
|
-
import React, { useEffect, useMemo, useState } from 'react'
|
|
4
|
-
import { useAsyncFn } from 'react-use'
|
|
5
|
-
import { ErrorCode } from '../_utils/GuardErrorCode'
|
|
6
|
-
import { useGuardHttp } from '../_utils/guradHttp'
|
|
7
|
-
import { useAuthClient } from '../Guard/authClient'
|
|
8
|
-
import { GuardModuleType } from '../Guard/module'
|
|
9
|
-
import { IconFont } from '../IconFont'
|
|
10
|
-
import { ShieldSpin, Spin } from '../ShieldSpin'
|
|
11
|
-
import { BindSuccess } from './core/bindSuccess'
|
|
12
|
-
import { SecurityCode } from './core/securityCode'
|
|
13
|
-
import { GuardBindTotpViewProps } from './interface'
|
|
14
|
-
import { useTranslation } from 'react-i18next'
|
|
15
|
-
import './styles.less'
|
|
16
|
-
const window: Window = require('global/window')
|
|
17
|
-
|
|
18
|
-
enum BindTotpType {
|
|
19
|
-
SECURITY_CODE = 'securityCode',
|
|
20
|
-
BIND_SUCCESS = 'bindSuccess',
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const GuardBindTotpView: React.FC<GuardBindTotpViewProps> = ({
|
|
24
|
-
config: GuardLocalConfig,
|
|
25
|
-
initData,
|
|
26
|
-
onLogin,
|
|
27
|
-
__changeModule,
|
|
28
|
-
}) => {
|
|
29
|
-
const { get, post } = useGuardHttp()
|
|
30
|
-
const { t } = useTranslation()
|
|
31
|
-
const [secret, setSecret] = useState('')
|
|
32
|
-
const [qrcode, setQrcode] = useState('')
|
|
33
|
-
const [user, setUser] = useState<User>()
|
|
34
|
-
const [bindTotpType, setBindTotpType] = useState<BindTotpType>(
|
|
35
|
-
BindTotpType.SECURITY_CODE
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
const authClient = useAuthClient()
|
|
39
|
-
|
|
40
|
-
const [bindInfo, fetchBindInfo] = useAsyncFn(async () => {
|
|
41
|
-
const query = {
|
|
42
|
-
type: 'totp',
|
|
43
|
-
source: 'APPLICATION',
|
|
44
|
-
}
|
|
45
|
-
const config = {
|
|
46
|
-
headers: {
|
|
47
|
-
authorization: initData.mfaToken,
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
const { data } = await get<any>(
|
|
53
|
-
`/api/v2/mfa/authenticator`,
|
|
54
|
-
query,
|
|
55
|
-
config
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
if (data.code === ErrorCode.LOGIN_INVALID) {
|
|
59
|
-
message.error(data.message)
|
|
60
|
-
__changeModule?.(GuardModuleType.LOGIN, {})
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
} catch (error: any) {
|
|
64
|
-
message.error(error?.message)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const { data } = await post<any>(
|
|
68
|
-
'/api/v2/mfa/totp/associate',
|
|
69
|
-
query,
|
|
70
|
-
config
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
setSecret(data.recovery_code)
|
|
74
|
-
setQrcode(data.qrcode_data_url)
|
|
75
|
-
}, [initData.mfaToken])
|
|
76
|
-
|
|
77
|
-
const onBind = () => {
|
|
78
|
-
if (user) onLogin?.(user, authClient)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const onNext = (user: User) => {
|
|
82
|
-
setUser(user)
|
|
83
|
-
setBindTotpType(BindTotpType.BIND_SUCCESS)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
fetchBindInfo()
|
|
88
|
-
}, [fetchBindInfo])
|
|
89
|
-
|
|
90
|
-
const renderContent = useMemo<
|
|
91
|
-
Record<BindTotpType, (props: any) => React.ReactNode>
|
|
92
|
-
>(
|
|
93
|
-
() => ({
|
|
94
|
-
[BindTotpType.SECURITY_CODE]: (props) => <SecurityCode {...props} />,
|
|
95
|
-
[BindTotpType.BIND_SUCCESS]: (props) => <BindSuccess {...props} />,
|
|
96
|
-
}),
|
|
97
|
-
[]
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
const onBack = () => {
|
|
101
|
-
window.history.back()
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<>
|
|
106
|
-
{bindInfo.loading ? (
|
|
107
|
-
<Spin />
|
|
108
|
-
) : (
|
|
109
|
-
<div className="g2-view-container">
|
|
110
|
-
<div className="g2-view-back">
|
|
111
|
-
<span onClick={onBack}>
|
|
112
|
-
<IconFont type="authing-back" />
|
|
113
|
-
<span>{t('common.backToVerify')}</span>
|
|
114
|
-
</span>
|
|
115
|
-
</div>
|
|
116
|
-
<div className="g2-mfa-content g2-mfa-bindTotp">
|
|
117
|
-
{bindInfo.loading ? (
|
|
118
|
-
<ShieldSpin />
|
|
119
|
-
) : (
|
|
120
|
-
renderContent[bindTotpType]({
|
|
121
|
-
mfaToken: initData.mfaToken,
|
|
122
|
-
qrcode,
|
|
123
|
-
secret,
|
|
124
|
-
onBind,
|
|
125
|
-
onNext,
|
|
126
|
-
changeModule: __changeModule,
|
|
127
|
-
})
|
|
128
|
-
)}
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
)}
|
|
132
|
-
</>
|
|
133
|
-
)
|
|
134
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getDefaultG2Config, IG2Config, IG2Events, IG2FCProps } from '../Type'
|
|
2
|
-
import { AuthenticationClient, User } from '..'
|
|
3
|
-
import { GuardMFAInitData } from '../MFA/interface'
|
|
4
|
-
|
|
5
|
-
export interface BindTotpConfig extends IG2Config {}
|
|
6
|
-
|
|
7
|
-
const defaultConfig: BindTotpConfig = {
|
|
8
|
-
...getDefaultG2Config(),
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const getDefaultMFAConfig = (): BindTotpConfig => ({
|
|
12
|
-
...getDefaultG2Config(),
|
|
13
|
-
...defaultConfig,
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
export interface BindTotpEvents extends IG2Events {
|
|
17
|
-
onLogin?: (user: User, authClient: AuthenticationClient) => void
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface GuardBindTotpInitData extends GuardMFAInitData {}
|
|
21
|
-
|
|
22
|
-
export interface GuardBindTotpProps extends IG2FCProps, BindTotpEvents {
|
|
23
|
-
config: Partial<BindTotpConfig>
|
|
24
|
-
initData: GuardBindTotpInitData
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface GuardBindTotpViewProps extends GuardBindTotpProps {
|
|
28
|
-
config: BindTotpConfig
|
|
29
|
-
initData: GuardBindTotpInitData
|
|
30
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
.g2-mfa-bindTotp {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
align-items: center;
|
|
5
|
-
height: 100%;
|
|
6
|
-
|
|
7
|
-
.g2-mfa-bindTotp-copySecret {
|
|
8
|
-
width: 100%;
|
|
9
|
-
height: 48px;
|
|
10
|
-
display: flex;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
align-items: center;
|
|
13
|
-
background: #f5f6f7;
|
|
14
|
-
border-radius: 4px;
|
|
15
|
-
|
|
16
|
-
.authing-ant-typography {
|
|
17
|
-
margin: 0;
|
|
18
|
-
|
|
19
|
-
svg {
|
|
20
|
-
color: #878a95 !important;
|
|
21
|
-
margin-left: 30px;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
.g2-mfa-bindTotp-secretSave {
|
|
26
|
-
margin-top: 16px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.g2-mfa-submit-button {
|
|
30
|
-
margin-top: 80px !important;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.g2-mfa-bindTotp-qrcode {
|
|
34
|
-
box-shadow: 0px 0px 30px rgba(84, 89, 104, 0.15);
|
|
35
|
-
border-radius: 4px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.g2-mfa-bindTotp-securityCode-form {
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
align-items: center;
|
|
42
|
-
|
|
43
|
-
.g2-mfa-submit-button {
|
|
44
|
-
margin-top: 64px !important;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.g2-mfa-totp-verify-input {
|
|
48
|
-
text-align: center;
|
|
49
|
-
margin-bottom: 8px !important;
|
|
50
|
-
margin-top: 40px !important;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
p {
|
|
54
|
-
color: #878a95;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
|
-
import { IconFont } from '../IconFont'
|
|
4
|
-
import { changeLang } from '../_utils/locales'
|
|
5
|
-
|
|
6
|
-
export const ChangeLanguage = (props: any) => {
|
|
7
|
-
const { i18n } = useTranslation()
|
|
8
|
-
if (props.langRange.length <= 1) {
|
|
9
|
-
return <></>
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let switchText = '简体中文'
|
|
13
|
-
if (i18n.language === 'en-US') {
|
|
14
|
-
switchText = 'English'
|
|
15
|
-
}
|
|
16
|
-
return (
|
|
17
|
-
<div className="g2-change-language-container">
|
|
18
|
-
<span
|
|
19
|
-
className="g2-change-language-button"
|
|
20
|
-
onClick={() => {
|
|
21
|
-
if (i18n.language === 'zh-CN') {
|
|
22
|
-
changeLang('en-US')
|
|
23
|
-
props.onLangChange?.('en-US')
|
|
24
|
-
} else if (i18n.language === 'en-US') {
|
|
25
|
-
changeLang('zh-CN')
|
|
26
|
-
props.onLangChange?.('zh-CN')
|
|
27
|
-
}
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
<IconFont type="authing-global-line" />
|
|
31
|
-
<span className="g2-change-language-text">{switchText}</span>
|
|
32
|
-
</span>
|
|
33
|
-
</div>
|
|
34
|
-
)
|
|
35
|
-
}
|