feat(X-Pack): 增加用户限制登录 #12638
This commit is contained in:
parent
ecfd072b73
commit
aaa8f5e3c3
@ -742,7 +742,7 @@ export default {
|
|||||||
reset_success: '重置成功',
|
reset_success: '重置成功',
|
||||||
modify_cur_pwd: '修改當前用戶密碼后需要重新登錄',
|
modify_cur_pwd: '修改當前用戶密碼后需要重新登錄',
|
||||||
switch_success: '切換成功',
|
switch_success: '切換成功',
|
||||||
user_name_pattern_error: '只允許數字字母以及._-且必須數字或字母開頭',
|
user_name_pattern_error: "只允許數字字母以及{'@'}._-且必須數字或字母開頭",
|
||||||
pwd_pattern_error: '6-20位且至少一位大寫字母、小寫字母、數字、特殊字符',
|
pwd_pattern_error: '6-20位且至少一位大寫字母、小寫字母、數字、特殊字符',
|
||||||
special_characters_are_not_supported: '不允許特殊字符',
|
special_characters_are_not_supported: '不允許特殊字符',
|
||||||
phone_format: '請填寫正確格式手機號',
|
phone_format: '請填寫正確格式手機號',
|
||||||
|
|||||||
@ -755,7 +755,7 @@ export default {
|
|||||||
reset_success: '重置成功',
|
reset_success: '重置成功',
|
||||||
modify_cur_pwd: '修改当前用户密码后需要重新登录',
|
modify_cur_pwd: '修改当前用户密码后需要重新登录',
|
||||||
switch_success: '切换成功',
|
switch_success: '切换成功',
|
||||||
user_name_pattern_error: '只允许数字字母以及._-且必须数字或字母开头',
|
user_name_pattern_error: "只允许数字字母以及{'@'}._-且必须数字或字母开头",
|
||||||
pwd_pattern_error: '6-20位且至少一位大写字母、小写字母、数字、特殊字符',
|
pwd_pattern_error: '6-20位且至少一位大写字母、小写字母、数字、特殊字符',
|
||||||
special_characters_are_not_supported: '不允许特殊字符',
|
special_characters_are_not_supported: '不允许特殊字符',
|
||||||
phone_format: '请填写正确格式手机号',
|
phone_format: '请填写正确格式手机号',
|
||||||
|
|||||||
@ -51,28 +51,42 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
footContent: ''
|
footContent: ''
|
||||||
})
|
})
|
||||||
const checkUsername = value => {
|
const checkUsername = (rule: any, value: any, callback: any) => {
|
||||||
if (!value) {
|
if (!value || activeName.value === 'ldap') {
|
||||||
return true
|
return callback()
|
||||||
}
|
}
|
||||||
const pattern = /^[a-zA-Z0-9][a-zA-Z0-9\@._-]*$/
|
const pattern = /^[a-zA-Z0-9][a-zA-Z0-9\@._-]*$/
|
||||||
const reg = new RegExp(pattern)
|
const reg = new RegExp(pattern)
|
||||||
return reg.test(value)
|
if (!reg.test(value)) {
|
||||||
|
const msg = t('user.user_name_pattern_error')
|
||||||
|
callback(new Error(msg))
|
||||||
|
}
|
||||||
|
return callback()
|
||||||
}
|
}
|
||||||
|
|
||||||
const validatePwd = value => {
|
const validatePwd = (rule: any, value: any, callback: any) => {
|
||||||
if (!value) {
|
if (!value || activeName.value === 'ldap') {
|
||||||
return true
|
return callback()
|
||||||
}
|
}
|
||||||
const pattern =
|
const pattern =
|
||||||
/^.*(?=.{6,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[~!@#$%^&*()_+\-\={}|":<>?`[\];',.\/])[a-zA-Z0-9~!@#$%^&*()_+\-\={}|":<>?`[\];',.\/]*$/
|
/^.*(?=.{6,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[~!@#$%^&*()_+\-\={}|":<>?`[\];',.\/])[a-zA-Z0-9~!@#$%^&*()_+\-\={}|":<>?`[\];',.\/]*$/
|
||||||
const regep = new RegExp(pattern)
|
const regep = new RegExp(pattern)
|
||||||
return regep.test(value)
|
if (!regep.test(value)) {
|
||||||
|
const msg = t('user.pwd_pattern_error')
|
||||||
|
callback(new Error(msg))
|
||||||
|
}
|
||||||
|
return callback()
|
||||||
}
|
}
|
||||||
|
|
||||||
const rules = reactive<FormRules>({
|
const rules = reactive<FormRules>({
|
||||||
username: [{ required: true, message: t('common.required'), trigger: 'blur' }],
|
username: [
|
||||||
password: [{ required: true, message: t('common.required'), trigger: 'blur' }]
|
{ required: true, message: t('common.required'), trigger: 'blur' },
|
||||||
|
{ required: true, validator: checkUsername, trigger: 'blur' }
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
{ required: true, message: t('common.required'), trigger: 'blur' },
|
||||||
|
{ required: true, validator: validatePwd, trigger: 'blur' }
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
const activeName = ref('simple')
|
const activeName = ref('simple')
|
||||||
@ -91,10 +105,10 @@ const handleLogin = () => {
|
|||||||
if (!formRef.value) return
|
if (!formRef.value) return
|
||||||
formRef.value.validate(async (valid: boolean) => {
|
formRef.value.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (!checkUsername(state.loginForm.username) || !validatePwd(state.loginForm.password)) {
|
/* if (!checkUsername(state.loginForm.username) || !validatePwd(state.loginForm.password)) {
|
||||||
ElMessage.error('用户名或密码错误')
|
ElMessage.error('用户名或密码错误')
|
||||||
return
|
return
|
||||||
}
|
} */
|
||||||
const name = state.loginForm.username.trim()
|
const name = state.loginForm.username.trim()
|
||||||
const pwd = state.loginForm.password
|
const pwd = state.loginForm.password
|
||||||
if (!wsCache.get(appStore.getDekey)) {
|
if (!wsCache.get(appStore.getDekey)) {
|
||||||
|
|||||||
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
|||||||
Subproject commit 0fbbd2f6394ea5197285ed51b3bb911413f3732f
|
Subproject commit b8975525241b57a4f753113bc860c16fbd8fca21
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package io.dataease.api.permissions.login.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AccountLockStatus implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 8310029430986389948L;
|
||||||
|
|
||||||
|
private Boolean locked = false;
|
||||||
|
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
private Long unlockTime;
|
||||||
|
|
||||||
|
private Integer relieveTimes;
|
||||||
|
|
||||||
|
private Integer remainderTimes;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user