| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void changePassword(String userOid, String password, |
| | | String confirmPassword) throws VciBaseException { |
| | | String confirmPassword) throws PLException { |
| | | WebUtil.alertNotNull(userOid,"用户主键",password,"密码",confirmPassword,"确认密码"); |
| | | if(!password.equals(confirmPassword)){ |
| | | throw new VciBaseException("密码和确认密码不相等"); |
| | | } |
| | | SmUserVO smUserVO = getUserByUserOid(userOid); |
| | | if(Func.isEmpty(smUserVO)){ |
| | | throw new VciBaseException("当前修改的用户不存在!"); |
| | | } |
| | | //TODO:校验密码是否符合策略 |
| | | String error = platformClientUtil.getFrameworkService().checkPasswordStrategyByUserId(smUserVO.getId(), password,null); |
| | | if (!StringUtils.isBlank(error)) { |
| | | throw new VciBaseException("当前设置的密码,密码策略校验未通过"); |
| | | } |
| | | ThreeDES des = new ThreeDES();// 实例化一个对�? |
| | | des.getKey("daliantan0v0");// 生成密匙 |
| | | String encPassword = des.getEncString(password); |
| | | String sql = "update pluser set plpassword = '" + encPassword + "' where pluid = '" + userOid.trim() + "'"; |
| | | |
| | | //修改密码的同时需要将密码修改时间也更新 |
| | | String sql = "update pluser set plpassword = '" + encPassword + "' plpwdupdatetime = '"+ System.currentTimeMillis() +"' where pluid = '" + userOid.trim() + "'"; |
| | | try { |
| | | platformClientUtil.getBOFactoryService().executeUpdateSql(sql); |
| | | } catch (PLException vciError) { |
| | |
| | | } |
| | | //根据当前创建这个用户的人所绑定密码策略来进行密码校验 |
| | | try { |
| | | String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); |
| | | String error = platformClientUtil.getFrameworkService().checkPasswordStrategyByUserId(userName, smUserDTO.getPassword(),null); |
| | | String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); |
| | | String error = platformClientUtil.getFrameworkService().checkPasswordStrategyByUserId(userId, smUserDTO.getPassword(),null); |
| | | if (!StringUtils.isBlank(error)) { |
| | | throw new VciBaseException("当前设置的密码,密码策略校验未通过"); |
| | | } |