Created
June 25, 2013 12:29
-
-
Save bognerf/5858064 to your computer and use it in GitHub Desktop.
Front Controller plugin for Zend Framework 1 to automatically check wether user is logged in or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Modul_Plugin_Login extends Zend_Controller_Plugin_Abstract | |
{ | |
public function preDispatch(Zend_Controller_Request_Abstract $request) | |
{ | |
$credentials = FUNCION_IS_LOGGED_IN(); | |
if (!Default_Model_Base::RZAccountIsValid($credentials->ndsaccount)) | |
{ | |
$request->setModuleName('ausleihe') | |
->setControllerName('user') | |
->setActionName('login-form') | |
->setDispatched(true); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Modul_UserController extends Zend_Controller_Action | |
{ | |
public function init() | |
{ | |
$front = Zend_Controller_Front::getInstance(); | |
$front->registerPlugin(new Module_Plugin_Login()); | |
$this->view->credentials = FUNCION_IS_LOGGED_IN(); | |
} | |
public function indexAction() | |
{ | |
} | |
public function logoutAction() | |
{ | |
} | |
public function loginAction() | |
{ | |
} | |
public function loginFormAction() | |
{ | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment