mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 13:32:18 +08:00
perf(X-Pack): 修改初始密码逻辑在 MFA 之前
This commit is contained in:
committed by
dataeaseShu
parent
fdc5c21fc0
commit
f91e5a1071
@@ -68,6 +68,7 @@ const getCurLocation = () => {
|
||||
}
|
||||
const enterHandler = e => {
|
||||
e.target.blur()
|
||||
e.stopPropagation()
|
||||
handleLogin()
|
||||
}
|
||||
const formRef = ref<FormInstance | undefined>()
|
||||
@@ -91,7 +92,16 @@ const handleLogin = () => {
|
||||
cleanPlatformFlag()
|
||||
loginApi(param)
|
||||
.then(res => {
|
||||
debugger
|
||||
const { token, exp, mfa } = res.data
|
||||
if (!isLdap && !xpackLoadFail.value && xpackInvalidPwd.value?.invokeMethod) {
|
||||
const param = {
|
||||
methodName: 'init',
|
||||
args: res.data
|
||||
}
|
||||
xpackInvalidPwd?.value.invokeMethod(param)
|
||||
return
|
||||
}
|
||||
if (!isLdap && mfa?.enabled) {
|
||||
xpackLoginHandler.value?.invokeMethod({ methodName: 'toMfa', args: mfa })
|
||||
duringLogin.value = false
|
||||
@@ -100,13 +110,6 @@ const handleLogin = () => {
|
||||
userStore.setToken(token)
|
||||
userStore.setExp(exp)
|
||||
userStore.setTime(Date.now())
|
||||
if (!isLdap && !xpackLoadFail.value && xpackInvalidPwd.value?.invokeMethod) {
|
||||
const param = {
|
||||
methodName: 'init'
|
||||
}
|
||||
xpackInvalidPwd?.value.invokeMethod(param)
|
||||
return
|
||||
}
|
||||
const queryRedirectPath = getCurLocation()
|
||||
router.push({ path: queryRedirectPath })
|
||||
})
|
||||
@@ -116,9 +119,16 @@ const handleLogin = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
const invalidPwdCb = val => {
|
||||
const invalidPwdCb = cbParam => {
|
||||
const val = cbParam['status']
|
||||
duringLogin.value = !!val
|
||||
if (val) {
|
||||
const mfa = cbParam['mfa']
|
||||
if (mfa?.enabled) {
|
||||
xpackLoginHandler.value?.invokeMethod({ methodName: 'toMfa', args: mfa })
|
||||
duringLogin.value = false
|
||||
return
|
||||
}
|
||||
const queryRedirectPath = getCurLocation()
|
||||
router.push({ path: queryRedirectPath })
|
||||
}
|
||||
|
||||
@@ -83,12 +83,23 @@ const handleBlur = () => {
|
||||
inputFocus.value = ''
|
||||
}
|
||||
|
||||
const invalidPwdCb = val => {
|
||||
const invalidPwdCb = cbParam => {
|
||||
const val = cbParam['status']
|
||||
duringLogin.value = !!val
|
||||
if (val) {
|
||||
const mfa = cbParam['mfa']
|
||||
if (mfa?.enabled) {
|
||||
for (const key in mfa) {
|
||||
mfaData.value[key] = mfa[key]
|
||||
}
|
||||
showMfa.value = true
|
||||
duringLogin.value = false
|
||||
return
|
||||
}
|
||||
router.push({ path: '/index' })
|
||||
}
|
||||
}
|
||||
|
||||
const closeMfa = () => {
|
||||
showMfa.value = false
|
||||
}
|
||||
@@ -114,6 +125,14 @@ const onSubmit = async () => {
|
||||
loginApi(param)
|
||||
.then(res => {
|
||||
const { token, exp, mfa } = res.data
|
||||
if (!xpackLoadFail.value && xpackInvalidPwd.value?.invokeMethod) {
|
||||
const param = {
|
||||
methodName: 'init',
|
||||
args: res.data
|
||||
}
|
||||
xpackInvalidPwd?.value.invokeMethod(param)
|
||||
return
|
||||
}
|
||||
showMfa.value = false
|
||||
if (mfa?.enabled) {
|
||||
for (const key in mfa) {
|
||||
@@ -126,13 +145,6 @@ const onSubmit = async () => {
|
||||
userStore.setToken(token)
|
||||
userStore.setExp(exp)
|
||||
userStore.setTime(Date.now())
|
||||
if (!xpackLoadFail.value && xpackInvalidPwd.value?.invokeMethod) {
|
||||
const param = {
|
||||
methodName: 'init'
|
||||
}
|
||||
xpackInvalidPwd?.value.invokeMethod(param)
|
||||
return
|
||||
}
|
||||
router.push({ path: '/index' })
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
@@ -9,6 +9,7 @@ import io.dataease.api.permissions.user.dto.*;
|
||||
import io.dataease.api.permissions.user.vo.*;
|
||||
import io.dataease.auth.DeApiPath;
|
||||
import io.dataease.auth.DePermit;
|
||||
import io.dataease.auth.vo.InvalidPwdVO;
|
||||
import io.dataease.auth.vo.TokenVO;
|
||||
import io.dataease.model.KeywordRequest;
|
||||
import io.dataease.request.BaseGridRequest;
|
||||
@@ -196,10 +197,6 @@ public interface UserApi {
|
||||
@GetMapping("/defaultOrgAdmin")
|
||||
boolean defaultOrgAdmin();
|
||||
|
||||
@Hidden
|
||||
@GetMapping("/invalidPwd")
|
||||
InvalidPwdVO invalidPwd();
|
||||
|
||||
@Hidden
|
||||
@PostMapping("/subOrgUser")
|
||||
List<UserItem> subOrgUser(@RequestBody List<Long> oidList);
|
||||
|
||||
@@ -12,6 +12,8 @@ public class ModifyPwdRequest implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6583458043271002864L;
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long uid;
|
||||
@Schema(description = "原始密码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String pwd;
|
||||
@Schema(description = "新密码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.dataease.api.permissions.user.vo;
|
||||
package io.dataease.auth.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
@@ -10,6 +12,9 @@ public class InvalidPwdVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3684394012648654165L;
|
||||
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long uid;
|
||||
|
||||
private boolean invalid;
|
||||
|
||||
private Long validityPeriod;
|
||||
@@ -24,6 +24,8 @@ public class TokenVO implements Serializable {
|
||||
|
||||
private MfaItem mfa;
|
||||
|
||||
private InvalidPwdVO invalidPwd;
|
||||
|
||||
public TokenVO(String token, Long exp) {
|
||||
this.token = token;
|
||||
this.exp = exp;
|
||||
|
||||
@@ -49,6 +49,7 @@ public class WhitelistUtils {
|
||||
"/sysParameter/defaultLogin",
|
||||
"/embedded/initIframe",
|
||||
"/sysParameter/i18nOptions",
|
||||
"/user/modifyPwd",
|
||||
"/");
|
||||
|
||||
public static boolean match(String requestURI) {
|
||||
|
||||
Reference in New Issue
Block a user