/**
  * @param  AdapterChainEvent $e
  * @return bool
  */
 public function authenticate(AdapterChainEvent $e)
 {
     if ($e->getIdentity()) {
         $userObject = $this->userMapper->findById($e->getIdentity());
         $registrationRecord = $this->userRegistrationMapper->findByUser($userObject);
         if (!$registrationRecord || !$registrationRecord->isResponded()) {
             $e->setCode(AuthenticationResult::FAILURE)->setMessages(array('Email Address not verified yet'));
             return false;
         }
         return true;
     }
     return false;
 }
 /**
  * gets user from user_id
  * it only queries one time for a user
  * @param int $id (user_id)
  *
  * @return UserMapperInterface
  */
 protected function getUser($id)
 {
     if (!isset($this->retrievedUsers[$id])) {
         $user = $this->userMapper->findById($id);
         $this->retrievedUsers[$id] = $user;
     }
     return $this->retrievedUsers[$id];
 }
 /**
  * Load user details based on configured authentication fields
  *
  * @param  string     $username
  * @return array|null
  */
 public function getUserDetails($username)
 {
     $user = null;
     $fields = $this->authOptions->getAuthIdentityFields();
     while (!is_object($user) && count($fields) > 0) {
         $mode = array_shift($fields);
         switch ($mode) {
             case 'username':
                 $user = $this->mapper->findByUsername($username);
                 break;
             case 'email':
                 $user = $this->mapper->findByEmail($username);
                 break;
         }
     }
     if (!$user instanceof UserInterface) {
         return NULL;
     }
     return array('user_id' => $user->getId(), 'username' => $user->getUsername(), 'email' => $user->getEmail(), 'display_name' => $user->getDisplayName(), 'state' => $user->getState());
 }
 /**
  * @param $userId
  * @return ZfcUserMapperInterface
  */
 public function getUser($userId)
 {
     return $this->zfcUserMapper->findById($userId);
 }
 public function __invoke($userId)
 {
     $user = $this->userMapper->findById($userId);
     return $user->getDisplayName();
 }
 /**
  * @covers Eye4web\ZfcUser\Pm\View\Helper\ZfcUserPmHelper::getUser
  */
 public function testGetUser()
 {
     $id = 1;
     $this->userMapperInterface->expects($this->once())->method('findById')->with($id);
     $this->helper->getUser($id);
 }