Esempio n. 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);
   }
 }
Esempio n. 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;
 }