/**
  * Creates a new session.
  *
  * @return \Ableron\Modules\Core\Model\Entities\SessionEntity
  */
 protected function create()
 {
     // create session (perform automatic user authentication if possible)
     $session = new SessionEntity(DefaultAuthenticationService::authenticateAutomatically());
     // set validation data
     foreach ($this->getValidators() as $validator) {
         $validator->setValidationData($session);
     }
     // return the session
     return $session;
 }
示例#2
0
 /**
  * @see \Ableron\Core\Controller\Action\ActionInterface::execute()
  */
 public function execute()
 {
     DefaultAuthenticationService::logout(Application::getSession());
 }
示例#3
0
 /**
  * @see \Ableron\Core\Controller\Page\AbstractPage::validateFormParameters()
  */
 public function validateFormParameters()
 {
     parent::validateFormParameters();
     // fire event: validate login data
     Application::getEventManager()->fireEvent(new LoginValidatingDataEvent($this->username, $this->password));
     // check whether username is set
     if ($this->username === '') {
         throw new FormParameterException(array('username', 'password'), 'core.backend.login.message.credentialsInvalid');
     }
     // check whether password is set
     if ($this->password === '') {
         throw new FormParameterException(array('username', 'password'), 'core.backend.login.message.credentialsInvalid');
     }
     // validate credentials
     if (($this->user = DefaultAuthenticationService::authenticateManually($this->username, $this->password)) === null) {
         throw new FormParameterException(array('username', 'password'), 'core.backend.login.message.credentialsInvalid');
     }
 }