# 优化用户名验证
This commit is contained in:
parent
ce22ad34ab
commit
44558bc751
|
@ -5,7 +5,7 @@
|
||||||
export function isvalidUsername(str) {
|
export function isvalidUsername(str) {
|
||||||
// const valid_map = ['xianfuxing', 'editor']
|
// const valid_map = ['xianfuxing', 'editor']
|
||||||
// return valid_map.indexOf(str.trim()) >= 0
|
// return valid_map.indexOf(str.trim()) >= 0
|
||||||
const usernameRegex = /^(?![0-9]+$)[0-9A-Za-z]{4,}$/
|
const usernameRegex = /^(?![0-9]+$)[0-9A-Za-z_]{4,}$/
|
||||||
return usernameRegex.test(str)
|
return usernameRegex.test(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue