redirecting to login. Once of the solutions I've used goes a little
something like this:
// on page that needs login
$session = new Zend_Session_Namespace('login');
$session->gotoAfterLogin = $this->_request->getRequestUri();
return $this->_redirect('login');
// on successful login
$session = new Zend_Session_Namespace('login');
if (isset($session->gotoAfterLogin)) {
$gotoAfterLogin = $session->gotoAfterLogin;
unset($session->gotoAfterLogin);
return $this->_redirect($gotoAfterLogin);
}
return $this->_redirect('/');
To avoid copy/pasting that first bit of code in all of your controllers you
can move it to an action helper. Also note the unset() prior to the redirect
-- if the user logs out and back in you don't want that redirect to occur
again.
--
*Hector Virgen*
Sr. Web Developer
Walt Disney Parks and Resorts Online
http://www.virgentech.com
没有评论:
发表评论