X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fcontroller%2Flogin%2Fclass_WebLoginAreaController.php;h=1a1900c3692c141fe04fb1a5ddb224542a84135f;hp=34893a10f9cf652452e98b0192e1c18ff9c98fc0;hb=2230a2e7e09b6b47fe3d68181a28a4435c1732e6;hpb=4365745a3952764d684556852c31d0e8cba5e58e diff --git a/inc/classes/main/controller/login/class_WebLoginAreaController.php b/inc/classes/main/controller/login/class_WebLoginAreaController.php index 34893a10f9..1a1900c369 100644 --- a/inc/classes/main/controller/login/class_WebLoginAreaController.php +++ b/inc/classes/main/controller/login/class_WebLoginAreaController.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -30,12 +30,6 @@ class WebLoginAreaController extends BaseController implements Controller { protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); - - // Set part description - $this->setObjectDescription("Default controller with news"); - - // Create unique ID number - $this->generateUniqueId(); } /** @@ -51,11 +45,20 @@ class WebLoginAreaController extends BaseController implements Controller { // Set the command resolver $controllerInstance->setResolverInstance($resolverInstance); - // Add some filters to this controller + // User auth filter $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_class')); + + // User update filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_class')); + + // News fetcher filter $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class')); + + // News proccess/display-preparation $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class')); + /* @todo: Add some filters to this controller */ + // Return the prepared instance return $controllerInstance; } @@ -68,11 +71,20 @@ class WebLoginAreaController extends BaseController implements Controller { * @return void */ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { - // Run the pre filters - $this->executePreFilters($requestInstance, $responseInstance); - // Get the command instance from the resolver by sending a request instance to the resolver - $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance); + $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); + + // Add more filters by the command + $commandInstance->addExtraFilters($this, $requestInstance); + + // Try to run the pre filters, if auth exceptions come through redirect here + try { + // Run the pre filters + $this->executePreFilters($requestInstance, $responseInstance); + } catch (UserAuthorizationException $e) { + // Redirect to main page + $responseInstance->redirectToConfiguredUrl('login_failed_url'); + } // This request was valid! :-D $requestInstance->requestIsValid();