예제 #1
0
 public function registerAction()
 {
     $options = $this->getRequest()->getPost();
     $user = new User();
     $user->exchangeArray(iterator_to_array($options));
     var_dump($user);
     $res = $this->getServiceLocator()->get('User\\Table\\UserTable')->insertUser($user);
     $this->redirect()->toRoute('application');
 }
예제 #2
0
 /**
  * Returns true if and only if email not exists in users table
  *
  * @param string $value
  * @return boolean
  * @throws \Exception
  */
 public function isValid($value)
 {
     $this->setValue($value);
     if (null !== $this->authService) {
         $user = $this->authService->getAuthentificatedUserEntity();
         if ($user && $user->username == $value) {
             return true;
         }
     }
     $user = $this->storage->getByEmail($value);
     if ($user) {
         $this->error(self::EMAIL_IN_USE);
         return false;
     }
     return true;
 }
예제 #3
0
 /**
  * Returns logged user entity
  *
  * @return UserEntity|false
  */
 public function getAuthentificatedUserEntity()
 {
     if (!$this->sessionContainer->userEntity && $this->isLoggedIn()) {
         $user = $this->userTable->getByEmail($this->authService->getIdentity());
         if ($user) {
             $this->sessionContainer->userEntity = $user->getValues();
         }
     }
     if ($this->sessionContainer->userEntity) {
         if (null === $this->authentificatedUser) {
             $this->authentificatedUser = $this->userTable->create($this->sessionContainer->userEntity);
         }
         return $this->authentificatedUser;
     }
     return false;
 }