| | |
| | | if (null == entity.getCreateDate()) { |
| | | entity.setCreateDate(new Date()); |
| | | } |
| | | // if (null == entity.getCompanyId()) { |
| | | // entity.setCompanyId(ContextUtil.getCompanyId(true)); |
| | | // } |
| | | |
| | | //密码加密 |
| | | int salt = RandomUtils.nextInt(27); |
| | | salt += 4; |
| | | bCryptPasswordEncoder = new BCryptPasswordEncoder(salt); |
| | | String password = bCryptPasswordEncoder.encode(entity.getPassword()); |
| | | BCryptPasswordEncoder encode = new BCryptPasswordEncoder(); |
| | | String password = encode.encode(entity.getPassword()); |
| | | // boolean b= bCryptPasswordEncoder.matches(entity.getPassword(),password); |
| | | entity.setPassword(password); |
| | | entity.setSalt(String.valueOf(salt)); |
| | |
| | | */ |
| | | @Expose |
| | | public String resetPassword(SysUser entity) { |
| | | |
| | | //密码加密 |
| | | int salt = RandomUtils.nextInt(27); |
| | | salt += 4; |
| | | bCryptPasswordEncoder = new BCryptPasswordEncoder(salt); |
| | | String password = bCryptPasswordEncoder.encode(Constant.DEFAULT_USER_PASSWORD); |
| | | BCryptPasswordEncoder encode = new BCryptPasswordEncoder(); |
| | | String password = encode.encode(Constant.DEFAULT_USER_PASSWORD); |
| | | entity.setPassword(password); |
| | | entity.setSalt(String.valueOf(salt)); |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | public boolean checkPassword(String inputPwd, SysUser user) { |
| | | BCryptPasswordEncoder encode = new BCryptPasswordEncoder(); |
| | | return encode.matches(inputPwd, user.getPassword()); |
| | | } |
| | | |
| | | } |