diff --git a/packages/guard-core-v4/src/Login/index.tsx b/packages/guard-core-v4/src/Login/index.tsx index 35c13438..b6f1a148 100644 --- a/packages/guard-core-v4/src/Login/index.tsx +++ b/packages/guard-core-v4/src/Login/index.tsx @@ -697,7 +697,7 @@ export const GuardLoginView: React.FC<{ isResetPage?: boolean }> = ({ tab={computedTabName( adI18n?.tab?.i18n?.[i18n.resolvedLanguage!] || adI18n?.tab?.default || - t('login.adLogin') + t('login.accountLogin') )} > { @@ -257,6 +258,13 @@ export const useMfaBusinessRequest = () => { // return AssociateFace(content) return null + }, + [MfaBusinessAction.VerifyCloudEntify]: (content: VerifyTotpContent) => { + if (isFlow) { + return authFlow(MfaBusinessAction.VerifyCloudEntify, content) + } + // TODO cxmt + return VerifyTotp(content) } } diff --git a/packages/guard-core-v4/src/MFA/core/cloudEntify.tsx b/packages/guard-core-v4/src/MFA/core/cloudEntify.tsx new file mode 100644 index 00000000..c4ec00e9 --- /dev/null +++ b/packages/guard-core-v4/src/MFA/core/cloudEntify.tsx @@ -0,0 +1,103 @@ +import { useTranslation } from 'react-i18next' +import { useAsyncFn } from 'react-use' +import { GuardMFAInitData, MFAConfig } from '../interface' +import SubmitButton from '../../SubmitButton' +import { VerifyCodeFormItem } from '../VerifyCodeInput/VerifyCodeFormItem' +import { VerifyCodeInput } from '../VerifyCodeInput' +import { MfaBusinessAction, useMfaBusinessRequest } from '../businessRequest' +import { Form } from 'shim-antd' +import { React } from 'shim-react' +const { useRef } = React + +export interface VerifyMFATotpProps { + mfaToken: string + mfaLogin: any + changeModule: any +} + +export const VerifyMFATotp: React.FC = ({ + mfaToken, + mfaLogin, + changeModule +}) => { + const { t } = useTranslation() + + const [form] = Form.useForm() + + const submitButtonRef = useRef(null) + + const businessRequest = + useMfaBusinessRequest()[MfaBusinessAction.VerifyCloudEntify] + + const [, onFinish] = useAsyncFn(async () => { + submitButtonRef.current?.onSpin(true) + + const mfaCode = form.getFieldValue('mfaCode') + + const requestData = { + totp: mfaCode.join(''), + mfaToken + } + + const { isFlowEnd, data, onGuardHandling } = await businessRequest( + requestData + ) + + submitButtonRef.current?.onSpin(false) + + if (isFlowEnd) { + mfaLogin(200, data) + } else { + submitButtonRef.current.onError() + + onGuardHandling?.() + } + }, [mfaToken]) + + return ( + <> +

{t('login.accPwdLoginVerify')}

+

{t('common.cloundEntifyCodes')}

+
{}} + onFinish={onFinish} + onFinishFailed={() => submitButtonRef.current.onError()} + > + + + + + + + + ) +} + +export interface MFATotpProps { + changeModule: any + config: MFAConfig + initData: GuardMFAInitData + mfaLogin: any +} + +export const MFACloudEntify: React.FC = ({ + changeModule, + initData, + mfaLogin +}) => { + return ( + <> + + + ) +} diff --git a/packages/guard-core-v4/src/MFA/index.tsx b/packages/guard-core-v4/src/MFA/index.tsx index e66a246a..42fead5c 100644 --- a/packages/guard-core-v4/src/MFA/index.tsx +++ b/packages/guard-core-v4/src/MFA/index.tsx @@ -12,6 +12,8 @@ import { MFAFace } from './core/face' import { MFATotp } from './core/totp' +import { MFACloudEntify } from './core/cloudEntify' + import { MFAMethods } from './mfaMethods' import { GuardMFAInitData, MFAType } from './interface' @@ -89,6 +91,14 @@ const ComponentsMapping: Record React.ReactNode> = { passkeyEnabled={initData.passkeyEnabled} mfaConfigsMap={mfaConfigsMap} /> + ), + [MFAType.CLOUDENTIFY]: ({ initData, config, changeModule, mfaLogin }) => ( + ) } diff --git a/packages/guard-core-v4/src/MFA/interface.ts b/packages/guard-core-v4/src/MFA/interface.ts index fff476f7..650c4339 100644 --- a/packages/guard-core-v4/src/MFA/interface.ts +++ b/packages/guard-core-v4/src/MFA/interface.ts @@ -25,7 +25,11 @@ export enum MFAType { EMAIL = 'EMAIL', TOTP = 'OTP', FACE = 'FACE', - PASSKEY = 'PASSKEY' + PASSKEY = 'PASSKEY', + /** + * cxmt 飞天云信 + */ + CLOUDENTIFY = 'CLOUDENTIFY' } export interface GuardMFAInitData { diff --git a/packages/guard-core-v4/src/MFA/mfaMethods/index.tsx b/packages/guard-core-v4/src/MFA/mfaMethods/index.tsx index 43ed42d3..7d41279c 100644 --- a/packages/guard-core-v4/src/MFA/mfaMethods/index.tsx +++ b/packages/guard-core-v4/src/MFA/mfaMethods/index.tsx @@ -40,7 +40,7 @@ const methodTitleMapping: Record< }, [MFAType.TOTP]: { title: () => i18n.t('common.OTPVerification'), - icon: 'authing-totp' + icon: 'authing-otp-fill' }, [MFAType.FACE]: { title: () => i18n.t('common.faceVerification'), @@ -49,6 +49,10 @@ const methodTitleMapping: Record< [MFAType.PASSKEY]: { title: () => 'Passkey', icon: 'authing-slideshow-3-line' + }, + [MFAType.CLOUDENTIFY]: { + title: () => i18n.t('common.cloudEntifyVerify'), + icon: 'authing-totp' } } diff --git a/packages/guard-core-v4/src/SubmitButton/index.tsx b/packages/guard-core-v4/src/SubmitButton/index.tsx index f74be9e8..3471805f 100644 --- a/packages/guard-core-v4/src/SubmitButton/index.tsx +++ b/packages/guard-core-v4/src/SubmitButton/index.tsx @@ -7,11 +7,12 @@ import { GuardButton } from '../GuardButton' import { useGuardButtonState } from '../_utils/context' import { ButtonProps } from 'shim-antd' +import { DefaultTFuncReturn } from 'i18next' const { forwardRef, useState, useImperativeHandle, useEffect } = React interface SubmitButtonProps extends ButtonProps { - text?: string + text?: string | DefaultTFuncReturn className?: string onClick?: any disabled?: boolean diff --git a/packages/guard-core-v4/src/Type/application.ts b/packages/guard-core-v4/src/Type/application.ts index 14d07f77..32e7cf13 100644 --- a/packages/guard-core-v4/src/Type/application.ts +++ b/packages/guard-core-v4/src/Type/application.ts @@ -413,6 +413,7 @@ export interface ApplicationConfig { validLoginMethods: Array | null validRegisterMethods: Array | null } + /** 是否开启自定义安全规则 */ customSecurityEnabled: boolean /** 应用的人机验证策略,始终开启、不开启、设置条件触发 */ diff --git a/packages/guard-core-v4/src/_utils/locales/en-us/common.json b/packages/guard-core-v4/src/_utils/locales/en-us/common.json index 084f9f39..e5bc956e 100644 --- a/packages/guard-core-v4/src/_utils/locales/en-us/common.json +++ b/packages/guard-core-v4/src/_utils/locales/en-us/common.json @@ -138,7 +138,7 @@ "feedback": "Need help ?", "loginProtocolTips": "Please check the login protocol", "registerProtocolTips": "Please check the registration agreement", - "accountLock": "The account is locked, please click the question mark below to give feedback", + "accountLock": "The account is locked. Please unlock it by yourself or contact the administrator.", "corsErrorMessage": "The current domain name is not in the list of allowed domain names", "corsErrorMessage2": "If you have any questions, you can refer to the document", "totpGenerateCode": "Generate a new recovery code for you, please record this key safely", @@ -229,5 +229,7 @@ "reVerify": "reverify", "inviteExpired": "The current invitation link has expired. Please contact the relevant administrator to resend the invitation for you.", "pageExpired": "The current page has expired. Please click the invitation link again to enter", - "inviteSuccess": "Successfully joined, please check your email. Please complete the login based on the information in the email." + "inviteSuccess": "Successfully joined, please check your email. Please complete the login based on the information in the email.", + "cloudEntifyVerify": "CloudEntify OTP Verification", + "cloundEntifyCodes": "Please enter the 6-digit security code you received" } diff --git a/packages/guard-core-v4/src/_utils/locales/en-us/login.json b/packages/guard-core-v4/src/_utils/locales/en-us/login.json index d486ceb3..99579711 100644 --- a/packages/guard-core-v4/src/_utils/locales/en-us/login.json +++ b/packages/guard-core-v4/src/_utils/locales/en-us/login.json @@ -131,5 +131,6 @@ "successTip": "Password reset succeeded", "backLogin": "Seconds will automatically jump to the login page" }, - "wecomScanLogin": "Enterprise WeChat scan code to log in" + "wecomScanLogin": "Enterprise WeChat scan code to log in", + "accountLogin": "Account Login" } diff --git a/packages/guard-core-v4/src/_utils/locales/ja-jp/common.json b/packages/guard-core-v4/src/_utils/locales/ja-jp/common.json index c5a5d152..1393fb0a 100644 --- a/packages/guard-core-v4/src/_utils/locales/ja-jp/common.json +++ b/packages/guard-core-v4/src/_utils/locales/ja-jp/common.json @@ -139,7 +139,7 @@ "feedback": "ヘルプ・お問い合わせ", "loginProtocolTips": "ログインプロトコルにチェックを入れてください", "registerProtocolTips": "登録プロトコルにチェックを入れてください", - "accountLock": "アカウントがロックされたら、下の疑問符をクリックしてフィードバックしてください", + "accountLock": "アカウントがロックされているので、セルフでロックを解除するか、管理者に連絡してロックを解除してください。", "corsErrorMessage": "現在のドメイン名はアクセスが許可されているドメイン名のリストには含まれていない。", "corsErrorMessage2": "質問があればドキュメント参照", "totpGenerateCode": "この鍵を安全に記録してください", @@ -229,5 +229,7 @@ "reVerify": "再検証", "inviteExpired": "現在の招待リンクは無効です。関連管理者に連絡して招待を再開してください。", "pageExpired": "現在のページは期限切れですので、招待リンクをもう一度クリックしてください", - "inviteSuccess": "正常に参加しました。メールを確認してください。メール内の情報に基づいてログインを完了してください。" + "inviteSuccess": "正常に参加しました。メールを確認してください。メール内の情報に基づいてログインを完了してください。", + "cloudEntifyVerify": "CloudEntify OTP パスワードの検証", + "cloundEntifyCodes": "受け取った6桁のセキュリティコードを入力してください" } diff --git a/packages/guard-core-v4/src/_utils/locales/ja-jp/login.json b/packages/guard-core-v4/src/_utils/locales/ja-jp/login.json index 6aa19d89..7165dda3 100644 --- a/packages/guard-core-v4/src/_utils/locales/ja-jp/login.json +++ b/packages/guard-core-v4/src/_utils/locales/ja-jp/login.json @@ -131,5 +131,6 @@ "successTip": "パスワードのリセットに成功しました", "backLogin": "秒ログインページが自動的にジャンプされます" }, - "wecomScanLogin": "エンタープライズ WeChat ログイン" + "wecomScanLogin": "エンタープライズ WeChat ログイン", + "accountLogin": "アカウントログイン" } diff --git a/packages/guard-core-v4/src/_utils/locales/zh-cn/common.json b/packages/guard-core-v4/src/_utils/locales/zh-cn/common.json index 1c096b76..7cc1579e 100644 --- a/packages/guard-core-v4/src/_utils/locales/zh-cn/common.json +++ b/packages/guard-core-v4/src/_utils/locales/zh-cn/common.json @@ -139,7 +139,7 @@ "feedback": "问题反馈", "loginProtocolTips": "请勾选登录协议", "registerProtocolTips": "请勾选注册协议", - "accountLock": "账号被锁定,请点击下方问号进行反馈", + "accountLock": "账号被锁定,请自助解锁或联系管理员进行解锁。", "corsErrorMessage": "当前域名不在允许访问的域名列表中。", "corsErrorMessage2": "如果有疑问可以参考文档", "totpGenerateCode": "为你生成一串新的恢复代码,请安全地记录这段密钥", @@ -229,5 +229,7 @@ "reVerify": "重新验证", "inviteExpired": "当前邀请链接已失效,请联系相关管理员为你重新发起邀请。", "pageExpired": "当前页面已过期,请重新点击邀请链接进入", - "inviteSuccess": "已成功加入,敬请查收邮件。请根据邮件内的信息完成登录。" + "inviteSuccess": "已成功加入,敬请查收邮件。请根据邮件内的信息完成登录。", + "cloudEntifyVerify": "飞天云信 OTP 口令验证", + "cloundEntifyCodes": "请输入获取的 6 位数字安全码" } diff --git a/packages/guard-core-v4/src/_utils/locales/zh-cn/login.json b/packages/guard-core-v4/src/_utils/locales/zh-cn/login.json index fd9af142..27fb65e6 100644 --- a/packages/guard-core-v4/src/_utils/locales/zh-cn/login.json +++ b/packages/guard-core-v4/src/_utils/locales/zh-cn/login.json @@ -131,5 +131,6 @@ "successTip": "密码重置成功", "backLogin": "秒后将自动跳转登录页" }, - "wecomScanLogin": "企业微信扫码登录" + "wecomScanLogin": "企业微信扫码登录", + "accountLogin": "账号登录" } diff --git a/packages/guard-core-v4/src/_utils/locales/zh-tw/common.json b/packages/guard-core-v4/src/_utils/locales/zh-tw/common.json index d5151d6f..f0ddb3f1 100644 --- a/packages/guard-core-v4/src/_utils/locales/zh-tw/common.json +++ b/packages/guard-core-v4/src/_utils/locales/zh-tw/common.json @@ -7,7 +7,7 @@ "registerTab": "{{text}}註冊", "SMS": "短信驗證碼驗證", "account": "賬號", - "accountLock": "賬號被鎖定,請點擊下方問號進行反饋", + "accountLock": "帳號被鎖定,請自助解鎖或聯系管理員進行解鎖。", "alreadyHasAcc": "已有賬號,", "areaCodePhone": "區號 手機號碼", "back": "返回", @@ -227,5 +227,7 @@ "reVerify": "重新驗證", "inviteExpired": "當前邀請連結已失效,請聯系相關管理員為你重新發起邀請。", "pageExpired": "當前頁面已過期,請重新點擊邀請連結進入", - "inviteSuccess": "已成功加入,敬請查收郵件。 請根據郵件內的資訊完成登入。" + "inviteSuccess": "已成功加入,敬請查收郵件。 請根據郵件內的資訊完成登入。", + "cloudEntifyVerify": "飛天雲信 OTP 口令驗證", + "cloundEntifyCodes": "請輸入取得的 6 位數字安全碼" } diff --git a/packages/guard-core-v4/src/_utils/locales/zh-tw/login.json b/packages/guard-core-v4/src/_utils/locales/zh-tw/login.json index 62390f81..b9c0aa0c 100644 --- a/packages/guard-core-v4/src/_utils/locales/zh-tw/login.json +++ b/packages/guard-core-v4/src/_utils/locales/zh-tw/login.json @@ -131,5 +131,6 @@ "successTip": "密碼重置成功", "backLogin": "秒後將自動跳轉登入頁" }, - "wecomScanLogin": "企業微信掃碼登入" + "wecomScanLogin": "企業微信掃碼登入", + "accountLogin": "賬號登錄" }