fix(系统设置):修改用户密码时增加确认密码框 (#1662)

Co-authored-by: 黎龙鑫 <lilongxinya@163.com>
This commit is contained in:
Ambitiousliga 2021-03-18 16:12:08 +08:00 committed by GitHub
parent 0ba062f008
commit af5a0edfe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -330,6 +330,9 @@
<el-form-item :label="$t('member.new_password')" prop="newpassword">
<el-input type="password" v-model="ruleForm.newpassword" autocomplete="off" show-password></el-input>
</el-form-item>
<el-form-item :label="$t('member.repeat_password')" prop="confirmpassword">
<el-input type="password" v-model="ruleForm.confirmpassword" autocomplete="off" show-password></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="ruleForm.id" autocomplete="off" :disabled="true" style="display:none"/>
</el-form-item>
@ -385,6 +388,15 @@ export default {
ShowMoreBtn
},
data() {
const validateConfirmPwd = (rule, value, callback) => {
if(value === ''){
callback(new Error(this.$t('user.input_password')));
}else if((value !== this.ruleForm.newpassword)){
callback(new Error(this.$t('member.inconsistent_passwords')));
}else{
callback();
}
};
return {
referenced: false,
queryPath: '/user/special/list',
@ -479,7 +491,17 @@ export default {
message: this.$t('member.password_format_is_incorrect'),
trigger: 'blur'
}
],
confirmpassword: [
{
required: true,
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
message: this.$t('member.password_format_is_incorrect'),
trigger: 'blur'
},
{trigger: ['blur', 'change'], validator: validateConfirmPwd}
]
}
}
},