| | |
| | | |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.exception.BusinessException; |
| | | import com.ruoyi.common.utils.RegexUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.security.ShiroUtils; |
| | | import com.ruoyi.common.utils.text.Convert; |
| | |
| | | @Override |
| | | @Transactional |
| | | public int insertUser(User user) { |
| | | if(StringUtils.isEmpty(user.getPassword())){ |
| | | throw new BusinessException("密码不能为空"); |
| | | } |
| | | if(!RegexUtil.isPassword(user.getPassword())){ |
| | | throw new BusinessException("密码无效。密码必须包含至少一个大写字母、一个小写字母和一个数字,并且至少10个字符长。"); |
| | | } |
| | | user.randomSalt(); |
| | | user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); |
| | | user.setCreateBy(ShiroUtils.getLoginName()); |
| | |
| | | */ |
| | | @Override |
| | | public int resetUserPwd(User user) { |
| | | if(StringUtils.isEmpty(user.getPassword())){ |
| | | throw new BusinessException("密码不能为空"); |
| | | } |
| | | if(!RegexUtil.isPassword(user.getPassword())){ |
| | | throw new BusinessException("密码无效。密码必须包含至少一个大写字母、一个小写字母和一个数字,并且至少10个字符长。"); |
| | | } |
| | | user.randomSalt(); |
| | | user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); |
| | | return updateUserInfo(user); |
| | |
| | | public User getUserByName(String createBy) { |
| | | return userMapper.getUserByName(createBy); |
| | | } |
| | | |
| | | @Override |
| | | public List<User> getAllUser() { |
| | | return userMapper.getAllUser(); |
| | | } |
| | | |
| | | @Override |
| | | public List<User> selectForUpdatePwd() { |
| | | return userMapper.selectForUpdatePwd(); |
| | | } |
| | | |
| | | @Override |
| | | public int updateUserForUpdatePwd(User user) { |
| | | return userMapper.updateUserForUpdatePwd(user); |
| | | } |
| | | } |