提交 270b7b9d authored 作者: liupengfei's avatar liupengfei

后台用户密码复杂度为大写字母小写字母和数字的组合

上级 4b9056b8
......@@ -108,7 +108,7 @@
<el-form-item v-if="dialogStatus==='create'" label="密码:" prop="password">
<el-input v-model="temp.password" clearable></el-input>
</el-form-item>
<el-form-item v-else-if="dialogStatus==='update'" label="密码:" :rules="pwdRule">
<el-form-item v-else-if="dialogStatus==='update'" label="密码:" prop="updatePassword">
<el-input v-model="temp.password" clearable></el-input>
</el-form-item>
<el-form-item label="电话:" prop="phone">
......@@ -183,26 +183,29 @@ export default {
})
}
};
const regPwd = /^[a-zA-Z0-9-_~\!\@\#\$\%\^\&\*\(\)\+\=]{6,20}$/;
// const regPwd = /^[a-zA-Z0-9-_~\!\@\#\$\%\^\&\*\(\)\+\=]{6,20}$/;
const regPwd = /^((?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*))[0-9A-Za-z]{6,20}$/;
const validatePwd = (rule, value, callback) => {
if(value.length > 20 || value.length < 6){
callback(new Error(`密码6-20位!现${value.length}位!`))
} else if ( !regPwd.test(value) ) {
callback(new Error('请使用字母、数字或符号“~!@#$%^&*()_+-=”的组合,6-20个字符'));
callback(new Error('请使用大写字母,小写字母和数字的组合,6-20个字符'));
} else {
callback()
}
};
const validateUpdate = (rule, value, callback) => {
value = this.temp.password;
if (value){
if(value.length > 20 || value.length < 6){
callback(new Error(`密码6-20位!现${value.length}位!`))
} else if ( !regPwd.test(value) ) {
callback(new Error('请使用字母、数字或符号“~!@#$%^&*()_+-=”的组合,6-20个字符'));
callback(new Error('请使用大写字母,小写字母和数字的组合,6-20个字符'));
} else {
callback()
}
}
callback();
};
const validatePhone = (rule, value, callback) => {
let telreg = /^(13\d|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18\d|19[89])\d{8}$/;
......@@ -246,13 +249,14 @@ export default {
rules: {
userName: [{ type: 'string', required: true, trigger: 'change', validator: validateName }],
password: [{ type: 'string', required: true, trigger: 'change', validator: validatePwd }],
updatePassword: [{ type: 'string', trigger: 'change', validator: validateUpdate }],
phone: [{ type: 'string', required: true, trigger: 'change', validator: validatePhone }],
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }],
deptList: [{ type: 'array', required: true, trigger: 'change', message: '未选择' }],
roleList: [{ type: 'array', required: true, trigger: 'change', message: '未选择' }],
isAdmin: [{ required: true }]
},
pwdRule: { trigger: 'change', validator: validateUpdate },
pwdRule: [{ type: 'string', trigger: 'change', validator: validateUpdate }],
dialogFormVisible: false,
dialogPvVisible: false,
sending: false,
......@@ -282,7 +286,7 @@ export default {
setTimeout(el=>{
let bodyHeight = document.body.clientHeight //body高度
let topHeight = (window.getComputedStyle(this.$refs.topHeight).height).replace(/[^\d\.]/g,''); //顶部高度
let searchHeight = (window.getComputedStyle(this.$refs.searchHeight).height).replace(/[^\d\.]/g,''); //检索部分高度
let searchHeight = (window.getComputedStyle(this.$refs.searchHeight).height).replace(/[^\d\.]/g,''); //检索部分高度
this.centerHeight = bodyHeight - topHeight - searchHeight - 90 - 83
},100)
},
......@@ -446,7 +450,7 @@ export default {
},
handleFilter() {
store.dispatch('SetUserManagementSerKeys',this.listQuery).then(res => {
})
this.listQuery.pageNum = 1
this.getList()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论