1、修改用户修改密码问题,由于avue版本兼容原因,改了调用方式。
| | |
| | | }, |
| | | methods: { |
| | | handleSubmit(form, done) { |
| | | if (this.index === 0) { |
| | | updateInfo(form).then(res => { |
| | | if (res.data.success) { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "修改信息成功!" |
| | | }); |
| | | if( form.oldPassword != undefined || form.newPassword1 != undefined || form.newPassword != undefined){ |
| | | updatePassword(form.oldPassword, form.newPassword, form.newPassword1).then(res => { |
| | | if (res.data.success) { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "修改成功!" |
| | | }); |
| | | } else { |
| | | this.$message({ |
| | | type: "error", |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | done(); |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type: "success", |
| | | message: "修改信息成功!" |
| | | }); |
| | | }; |
| | | } else { |
| | | this.$message({ |
| | | type: "error", |
| | |
| | | window.console.log(error); |
| | | done(); |
| | | }) |
| | | } else { |
| | | updatePassword(md5(form.oldPassword), md5(form.newPassword), md5(form.newPassword1)).then(res => { |
| | | if (res.data.success) { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "修改密码成功!" |
| | | }); |
| | | } else { |
| | | this.$message({ |
| | | type: "error", |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | done(); |
| | | }) |
| | | } |
| | | }, |
| | | handleWitch() { |
| | | if (this.index === 0) { |
| | |
| | | if (!newPassword.equals(newPassword1)) { |
| | | throw new ServiceException("请输入正确的确认密码!"); |
| | | } |
| | | if (!user.getPassword().equals(DigestUtil.hex(oldPassword))) { |
| | | throw new ServiceException("原密码不正确!"); |
| | | } |
| | | //获取用户采用的密码策略 |
| | | Strategy strategy = sysClient.getByUserId(userId).getData(); |
| | | // 几乎不会出现这种情况 |
| | |
| | | if(newPassword1.length() < strategy.getMinPwdLen() || newPassword1.length() > strategy.getMaxPwdLen()){ |
| | | throw new ServiceException("密码中必须含有【"+strategy.getCombinationNames()+"】中的【"+strategy.getRequiredType()+"】种密码组合方式,且密码长度必须在【"+strategy.getMinPwdLen()+"-"+strategy.getMaxPwdLen()+"】范围内"); |
| | | } |
| | | |
| | | oldPassword = DigestUtil.hex(DigestUtils.md5DigestAsHex((oldPassword).getBytes())); |
| | | if (!user.getPassword().equals(oldPassword)) { |
| | | throw new ServiceException("原密码不正确!"); |
| | | } |
| | | List<String> regexs = sysClient.getRegexByList(Arrays.asList(strategy.getCombinationIds().split(","))).getData(); |
| | | //判断是否满足组合方式中的必填种类数 |
| | | int reqType = 0; |