예제 #1
0
 @Override
 public boolean isOldPasswordCorrect(String password, int userId) {
   User user = findUserById(userId);
   if (user.getPassword().equals(password)) {
     return true;
   }
   return false;
 }
예제 #2
0
 @Override
 public boolean changePassword(String password, int userId) {
   User user = findUserById(userId);
   user.setPassword(password);
   try {
     em.persist(user);
     return true;
   } catch (Exception e) {
     e.printStackTrace();
     return false;
   }
 }
예제 #3
0
 @Override
 public User create(User user) {
   if (user.getId() <= 0) {
     em.persist(user);
   } else {
     user = em.merge(user);
   }
   return user;
 }