/**
  * @see \Ableron\Core\Controller\AbstractController::init()
  */
 protected function init()
 {
     parent::init();
     // by default authentication is required for controllers of the backend
     $this->setAuthenticationRequired(true);
     // set login URL
     $this->setAuthenticationLoginUrl(EnvironmentUtil::getInternalUrl('/login'));
     // set permissions required by default for backend controllers
     $this->getRequiredPermissions()->add('Core.System.Backend.canAccessBackend');
     // indicate backend responses to not be cachable
     Application::getResponseHandler()->getResponse()->setCachable(false);
 }
 /**
  * @see \Ableron\Core\Controller\AbstractController::run()
  */
 protected function run()
 {
     // check for valid CSRF token before executing action
     if ($this->checkCsrfToken()) {
         try {
             $this->readParameters();
             $this->readData();
             $this->execute();
             $this->onExecuteSuccessful();
         } catch (ExecutionFailedException $e) {
             $this->onExecuteFailed();
         }
     } else {
         $this->setFlashMessage(Application::getI18nHandler()->getTranslator()->translate('core.security.csrf.actionNotExecuted'), null, ControllerInterface::MESSAGE_TYPE_ERROR);
     }
     // if we are here, no redirect has been sent during execution; so redirect to action source URL
     if (($encodedActionSourceUrl = $this->getQueryParameter(ABLERON_PARAM_ACTION_SOURCE_URL, false)) !== false && ($actionSourceUrl = StringUtil::base64UrlDecode($encodedActionSourceUrl)) !== false) {
         $this->redirectTo(new Uri($actionSourceUrl));
     } else {
         $this->redirectTo(EnvironmentUtil::getInternalUrl('/'));
     }
 }
 /**
  * @see \Ableron\Core\Controller\Action\ActionInterface::onExecuteSuccessful()
  */
 public function onExecuteSuccessful()
 {
     Application::getResponseHandler()->sendRedirect(EnvironmentUtil::getInternalUrl('/'));
 }
Exemple #4
0
 /**
  * Redirects the user to the index page.
  *
  * @see \Ableron\Core\Controller\Page\AbstractPage::onProcessFormSuccessful()
  */
 public function onProcessFormSuccessful()
 {
     parent::onProcessFormSuccessful();
     // fire event: login attempt succeeded
     Application::getEventManager()->fireEvent(new LoginAttemptSuccessfulEvent($this->username, $this->password));
     // redirect to index page
     $this->redirectTo(EnvironmentUtil::getInternalUrl('/'));
 }