Hi,

My app checks sessions on preDispatch and redirects page to login page if
session not exists.
Everything  was ok upto now because there was no need to ajax. But with the
ajax implementation some problems occured.

Here is the case;

   1. User requests a page (P)
   2. In  page P, a user action opens a modal window (MW).
   3. MW loads content via ajax

But if a long time passes between 1 an 2 session ends. So the modal window
show a full login page (with header, menus, footer as it is)

this is because preDispatch redirects ajax request to login page.

*So how do you handles such contidions?*

Here is my solution (I know it is not a good solution so need your better
ideas)

http://pastebin.com/SLkz2AmX

public function preDispatch() {

        if (! Zend_Auth::getInstance ()->hasIdentity ())
            if(!$this->getRequest()->isXmlHttpRequest()){
               $this->_redirect ( 'auth/login/' );
                         }
            else {
               echo 'Sesison ended.Please relogin.';
               exit;
         }
    }

Reply via email to