예제 #1
0
 @Override
 public void changePassword(Long userId, String password) {
   try {
     User user = userDao.selectUser(userId);
     user.setPassword(password);
     passwordHelper.encryptPassword(user);
     userDao.updateUser(user);
   } catch (Exception e) {
     logger.error("change password error", e);
   }
 }
예제 #2
0
 @Override
 public User createUser(User user) {
   try {
     if (StringUtils.hasText(user.getUsername()) && StringUtils.hasText(user.getPassword())) {
       User tempUser = findUserByUsername(user.getUsername());
       if (tempUser == null) {
         passwordHelper.encryptPassword(user);
         userDao.createUser(user);
         return findUserByUsername(user.getUsername());
       }
     }
   } catch (Exception e) {
     logger.error("create user error", e);
   }
   return null;
 }