Esempio n. 1
0
 @Override
 public boolean isRegistered(String email) {
   try {
     User user = userDao.findByEmail(email);
     if (user != null) {
       return true;
     }
   } catch (DatabaseException e) {
     LOG.error("Checking register failed", e);
   }
   return false;
 }
Esempio n. 2
0
 @Override
 public User getUser(MessageManager message, String email) throws LogicException {
   try {
     User user = userDao.findByEmail(email);
     if (user == null) {
       message.addMessage(MSG_LOGIN);
       throw new LogicException("Getting user failed");
     }
     return user;
   } catch (DatabaseException e) {
     message.addMessage(MSG_LOGIN);
     throw new LogicException("Getting user failed", e);
   }
 }
Esempio n. 3
0
 @Override
 public boolean login(MessageManager message, User user) {
   if (user == null) {
     LOG.warn("User is null");
     return false;
   }
   int password = user.getPassword();
   try {
     user = userDao.findByEmail(user.getEmail());
     if (user == null || user.getPassword() != password) {
       message.addMessage(MSG_ICORRECT);
       return false;
     }
   } catch (DatabaseException e) {
     LOG.error("Login failed", e);
     message.addMessage(MSG_LOGIN);
     return false;
   }
   return true;
 }