From 21dc31da552d152f044367743d7ef06585716983 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 31 Dec 2024 15:02:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(X-Pack):=20Ldap=20=E5=AF=B9=E6=8E=A5=20AD?= =?UTF-8?q?=20=E5=9F=9F=E5=8F=AF=E4=BB=A5=E5=85=8D=E5=AF=86=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/locales/en.ts | 4 +- core/core-frontend/src/locales/tw.ts | 4 +- core/core-frontend/src/locales/zh-CN.ts | 4 +- core/core-frontend/src/views/login/index.vue | 42 ++++++++------------ de-xpack | 2 +- 5 files changed, 26 insertions(+), 30 deletions(-) diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index 308697eb4c..725ccc428a 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -416,7 +416,9 @@ export default { btn: 'Login', username_format: "1-25 alphanumeric characters or ._-:{'@'} and start with a letter or number", pwd_format: 'Password length is 5-15', - default_login: 'Default' + default_login: 'Default', + ldap_login: 'LDAP Login', + account_login: 'Account Login' }, component: { columnList: 'List item', diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts index bfc13947e7..4705c02b62 100644 --- a/core/core-frontend/src/locales/tw.ts +++ b/core/core-frontend/src/locales/tw.ts @@ -407,7 +407,9 @@ export default { btn: '登入', username_format: "1-25位元字母數字或._-:{'@'}且以字母或數字開頭", pwd_format: '密碼長度在5-15', - default_login: '預設' + default_login: '預設', + ldap_login: 'LDAP 登錄', + account_login: '賬號登錄' }, component: { columnList: '列表項目', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 27d497de2a..ed891ffb57 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -408,7 +408,9 @@ export default { btn: '登录', username_format: "1-25位字母数字或者._-:{'@'}且以字母或数字开头", pwd_format: '密码长度在5-15', - default_login: '默认' + default_login: '默认', + ldap_login: 'LDAP 登录', + account_login: '账号登录' }, component: { columnList: '列表项', diff --git a/core/core-frontend/src/views/login/index.vue b/core/core-frontend/src/views/login/index.vue index 39b3fbe189..29612d024a 100644 --- a/core/core-frontend/src/views/login/index.vue +++ b/core/core-frontend/src/views/login/index.vue @@ -80,12 +80,16 @@ const handleLogin = () => { wsCache.set(appStore.getDekey, res.data) } const param = { name: rsaEncryp(name), pwd: rsaEncryp(pwd) } + const isLdap = activeName.value === 'ldap' + if (isLdap) { + param['origin'] = 1 + } duringLogin.value = true cleanPlatformFlag() loginApi(param) .then(res => { const { token, exp, mfa } = res.data - if (mfa?.enabled) { + if (!isLdap && mfa?.enabled) { xpackLoginHandler.value?.invokeMethod({ methodName: 'toMfa', args: mfa }) duringLogin.value = false return @@ -93,7 +97,7 @@ const handleLogin = () => { userStore.setToken(token) userStore.setExp(exp) userStore.setTime(Date.now()) - if (!xpackLoadFail.value && xpackInvalidPwd.value?.invokeMethod) { + if (!isLdap && !xpackLoadFail.value && xpackInvalidPwd.value?.invokeMethod) { const param = { methodName: 'init' } @@ -109,18 +113,6 @@ const handleLogin = () => { } }) } -const ldapValidate = callback => { - if (!formRef.value) return - formRef.value.validate((valid: boolean) => { - if (valid && callback) { - duringLogin.value = true - callback() - } - }) -} -const ldapFeedback = () => { - duringLogin.value = false -} const invalidPwdCb = val => { duringLogin.value = !!val if (val) { @@ -303,14 +295,21 @@ onMounted(async () => { {{ slogan || '人人可用的开源 BI 工具' }}
- -