From ff88701431fff881c67bcb251774c6a4dd6776c4 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 20 Dec 2024 10:47:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(X-Pack):=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=A2=9E=E5=8A=A0=20MFA=20=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/mobile/login/index.vue | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/views/mobile/login/index.vue b/core/core-frontend/src/views/mobile/login/index.vue index 73b35bb238..2b1b865a19 100644 --- a/core/core-frontend/src/views/mobile/login/index.vue +++ b/core/core-frontend/src/views/mobile/login/index.vue @@ -35,6 +35,9 @@ const duringLogin = ref(false) const xpackLoadFail = ref(false) const xpackInvalidPwd = ref() +const mfaRef = ref() +const showMfa = ref(false) +const mfaData = ref({ enabled: false, ready: false, uid: '', origin: 0 }) const checkUsername = value => { if (!value) { @@ -86,6 +89,12 @@ const invalidPwdCb = val => { router.push({ path: '/index' }) } } +const closeMfa = () => { + showMfa.value = false +} +const mfaSuccess = () => { + router.push({ path: '/index' }) +} const onSubmit = async () => { if (!checkUsername(username.value) || !validatePwd(password.value)) { showToast({ @@ -104,7 +113,16 @@ const onSubmit = async () => { duringLogin.value = true loginApi(param) .then(res => { - const { token, exp } = res.data + const { token, exp, mfa } = res.data + showMfa.value = false + if (mfa?.enabled) { + for (const key in mfa) { + mfaData.value[key] = mfa[key] + } + showMfa.value = true + duringLogin.value = false + return + } userStore.setToken(token) userStore.setExp(exp) userStore.setTime(Date.now()) @@ -194,6 +212,14 @@ const usernameEndValidate = ({ status, message }) => { @load-fail="() => (xpackLoadFail = true)" @call-back="invalidPwdCb" /> +