Commit 401a99d9 by liangjianmin

fix(menu): 修复密码确认输入提示及验证逻辑

- 修改确认新密码输入框的placeholder为“请再次输入新密码”
- 新增两次密码输入一致性校验,防止提交不匹配密码
- 优化成功和失败提示信息的显示类型,区分成功与错误状态
- 提交后添加延迟跳转和刷新操作确保状态更新及时反馈用户
parent 53d72d7d
Showing with 32 additions and 5 deletions
......@@ -107,7 +107,7 @@
<el-input v-model="ruleForm.password" type='password' placeholder='请输入新密码' autocomplete="new-password"></el-input>
</el-form-item>
<el-form-item label="确认新密码" prop="repassword">
<el-input v-model="ruleForm.repassword" type='password' placeholder='请输入新密码' autocomplete="new-password"></el-input>
<el-input v-model="ruleForm.repassword" type='password' placeholder='请再次输入新密码' autocomplete="new-password"></el-input>
</el-form-item>
<el-form-item>
<el-button @click="dialogVisible = false">取 消</el-button>
......@@ -130,7 +130,7 @@
<el-input v-model="smsForm.password" type='password' placeholder='请输入新密码' autocomplete="new-password"></el-input>
</el-form-item>
<el-form-item label="确认新密码" prop="repassword">
<el-input v-model="smsForm.repassword" type='password' placeholder='请输入新密码' autocomplete="new-password"></el-input>
<el-input v-model="smsForm.repassword" type='password' placeholder='请再次输入新密码' autocomplete="new-password"></el-input>
</el-form-item>
<el-form-item>
<el-button @click="dialogVisible = false">取 消</el-button>
......@@ -1014,9 +1014,21 @@
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
// 再次验证两次密码是否一致
if (this.ruleForm.password !== this.ruleForm.repassword) {
this.$message({
message: '两次输入的密码不一致,请重新输入',
type: 'error'
});
return false;
}
this.$http('post', "/api/user/setpasswd", this.ruleForm).then(res => {
if (res.code === 0) {
this.$message('修改成功');
this.$message({
message: '修改成功',
type: 'success'
});
setTimeout(() => {
Util.delCookie('token');
window.location.href = '/#/login';
......@@ -1024,7 +1036,10 @@
history.go(0);
}, 2000)
} else {
this.$message(res.msg);
this.$message({
message: res.msg,
type: 'error'
});
}
}).catch(err => {
console.log(err.message);
......@@ -1041,6 +1056,15 @@
submitSmsForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
// 再次验证两次密码是否一致
if (this.smsForm.password !== this.smsForm.repassword) {
this.$message({
message: '两次输入的密码不一致,请重新输入',
type: 'error'
});
return false;
}
this.$http('post', "/api/user/setPasswdBySmsCode", {
password: this.smsForm.password,
sms_code: this.smsForm.smsCode
......@@ -1058,7 +1082,10 @@
history.go(0);
}, 2000)
} else {
this.$message(res.msg);
this.$message({
message: res.msg,
type: 'error'
});
}
}).catch(err => {
console.log(err.message);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment