Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Admin_AuthController
- extends Zend_Controller_Action
- {
- // isPublicAction {{{
- protected function isPublicAction()
- {
- return in_array($this->getRequest()->getActionName(), $this->_public_actions);
- }
- // }}}
- // isLoggedIn {{{
- protected function isLoggedIn()
- {
- // Authenticate the user
- return Zend_Auth::getInstance()->hasIdentity();
- }
- // }}}
- // init {{{
- public function init()
- {
- // If not logging in or out and not authenticated
- if (!($this->isPublicAction() || $this->isLoggedIn()))
- {
- // Force login
- return $this->_helper->redirector->gotoUrl('/admin/index/login/');
- }
- parent::init();
- $this->layout_view->nav_template = 'member';
- // paranoia check before retrieving member information
- if (!$this->isPublicAction())
- {
- $member_session = new Zend_Session_Namespace('member_acct_information');
- $this->view->profile = $member_session->profile;
- }
- }
- protected $_public_actions = array(
- 'view',
- 'forgotpassword',
- 'resetpassword',
- 'login',
- 'logout'
- );
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement