2008年9月29日星期一

Re: [fw-auth] redirect problem

Actually, I think it's within the first code snippet you sent :-)

On Mon, Sep 29, 2008 at 10:07 AM, Jigal sanders <jigalroecha@gmail.com> wrote:
Well,

I have a plugin which a preDispach function.
Within the predispach I have the following

    if ($isDispatchable && !$this->_acl->isAllowed($role, $resource, $action)) {
      if (!$this->_auth->hasIdentity()) {
        // Not logged in, send to login page
        $module = $this->_noauth['module'];
        $controller = $this->_noauth['controller'];
        $action     = $this->_noauth['action'];

      } else {
        // Permission to access resource denied.  Send to error page.
        $module     = $this->_noauth['module'];
        $controller = $this->_noauth['controller'];
        $action     = $this->_noauth['action'];

Here is where you can add some request parameters indicating what "page" (or module/action/params) to come back to. Something like:

            $request->setParam('return', array(
                'module'    => $request->getModuleName(),
                'controller' => $request->getControllerName(),
                'action'     => $request->getActionName(),
            ));

You would then need to retrieve the value of the 'return' param in your login action and use that once the user has authenticated. Like I said, you may need to also save that to a session variable (or include it in each login submission) so it can persist across multiple login attempts.
 

      }
    }
    $request->setModuleName($module);
    $request->setControllerName($controller);
    $request->setActionName($action);


Is it just a  matter of changing this code?


On Mon, Sep 29, 2008 at 2:00 PM, Bradley Holt <bradley.holt@foundline.com> wrote:
You would have to implement this in your application's logic - I don't know of anything in Zend Framework that does this specifically. When you forward to the login page, include parameters indicating the page from which you forwarded. When the login is complete, use those parameters to forward back to that original page (you may have to save those parameters to a session variable so they persist across multiple login attempts).


On Mon, Sep 29, 2008 at 6:52 AM, Jigal sanders <jigalroecha@gmail.com> wrote:
Hello everyone,

I am using Zend_Acl in combination with login.
Every time when I try to go to a page, the system checks if I am logged in. In case I'm not, it redirects me to a login page. Here I can enter my credentials and log in again.
But when I am logged in it doesn't redirect me to the page I wanted to get originally. How can I make sure it redirects me to the page i wanted originally?

Thanks,

J. Sanders



--
Bradley Holt
bradley.holt@foundline.com








--
Bradley Holt
bradley.holt@foundline.com

没有评论: