/**
  * @param \SKL\Test\Domain\Model\User $user
  * @return \SKL\Test\Domain\Model\User
  */
 public function findUserIdentity(\SKL\Test\Domain\Model\User $user)
 {
     $users = $this->findAll()->toArray();
     for ($i = 0; $i < count($users); $i++) {
         if ($users[$i]->getName() === $user->getName()) {
             return $users[$i];
         }
     }
 }
 /**
  * @return void
  */
 public function successAction(User $loginUser)
 {
     session_start();
     $users = $this->userRepository->findActiveUser();
     $test = false;
     foreach ($users as $user) {
         if (strcmp($user->getName(), $loginUser->getName()) == 0) {
             if (strcmp($user->getPassword(), $loginUser->getPassword()) == 0) {
                 $test = true;
             } else {
                 $this->addFlashMessage("Sorry the password you enter is incorrect!");
                 $this->redirect('login');
             }
         }
     }
     if ($test == false) {
         $this->addFlashMessage("Sorry name and password you enter is invalid!");
         $this->redirect('login');
     }
     $_SESSION['usrname'] = $loginUser->getName();
     // \TYPO3\Flow\var_dump($this->userRepository->findUserIdentity($loginUser));
     // die();
     $_SESSION['identity'] = $this->userRepository->findUserIdentity($loginUser);
     //echo $_SESSION['usrname'];
     $this->redirect('index', 'form');
 }
 /**
  * {@inheritDoc}
  */
 public function setEmail($email)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setEmail', array($email));
     return parent::setEmail($email);
 }