Пример #1
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.ozsoft.taskman.services.UserService#checkCredentials(java.lang.String
  * , java.lang.String)
  */
 @Override
 public boolean checkCredentials(String username, String password) {
   boolean valid = false;
   User user = retrieve(username);
   if (user != null && user.getPassword().equals(password)) {
     valid = true;
   }
   return valid;
 }
Пример #2
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.ozsoft.taskman.services.UserService#update(org.ozsoft.taskman.domain
  * .User)
  */
 @Override
 public void update(User user) {
   EntityTransaction tx = em.getTransaction();
   tx.begin();
   try {
     em.merge(user);
     tx.commit();
     LOG.debug(String.format("Updated user '%s'", user.getUsername()));
   } catch (PersistenceException e) {
     LOG.error(String.format("Error updating user '%s'", user.getUsername()), e);
     tx.rollback();
     throw e;
   }
 }