예제 #1
0
 /** {@inheritDoc} */
 @Override
 public boolean logout(String name, String password) {
   boolean disconnected = false;
   IUser user = getByNameAndPassword(name, password);
   if (user != null) {
     if (user.getContact() != null && user.getContact().isOnline()) {
       user.getContact().setOnline(false);
       connectionService.delete(user.getContact().getConnection().getId());
       user.getContact().setConnection(null);
       contactService.update(user.getContact());
       disconnected = true;
     }
   }
   return disconnected;
 }
예제 #2
0
 @Override
 public IUser login(String name, String password) {
   IUser user = userRepository.findByNameAndPassword(name, password);
   if (user != null) {
     if (user.getContact() != null && user.getContact().getId() != null) {
       user.getContact().setOnline(true);
       IConnection connection = connectionService.createConnection();
       user.getContact().setConnection(connection);
       contactService.update(user.getContact());
     }
   } else {
     user = createInstance();
     user.getContact().setOnline(false);
   }
   return user;
 }