Created
November 28, 2011 17:47
-
-
Save sebastianhoitz/1401279 to your computer and use it in GitHub Desktop.
Zend Framework Auth plugin
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 App_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract | |
{ | |
public function preDispatch(Zend_Controller_Request_Abstract $request) | |
{ | |
$auth = Zend_Auth::getInstance(); | |
if (!$auth->hasIdentity() | |
&& !($request->getControllerName() == "session" | |
&& $request->getActionName() == "login")) | |
{ | |
$request->setControllerName("session") | |
->setActionName("login") | |
->setModuleName("") | |
->setDispatched(false); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment