Back returns the user to a secure page after logging out of -zend framework

I created a login for logging in, logging out to access the control panel, the scenario is as follows: the user logs in and opens access to the cpanel page, and they log out. Problem: when logging in, if the user clicks the back button "browser, the user will return to the login page, even if authentication is completed and the sessions are established, at the same time, if the user exits and click the" Back "button, he will return to the control panel page (if the user refreshes the page, then all It doesn’t seem fine, and usr will be redirected to the login, and the back button will not redirect it to cpanel).

The problem is in the browser cache, I tried with the php and html meta header to prevent page caching, but I could not succeed. Any solution for this?

My exit action code is as follows:

public function logoutAction()
      {   
         $auth=Zend_Auth::getInstance();
      //If logged in then move to index
         if(!$auth->hasIdentity()){
           $this->_redirect('admin/account/redirect');

      }
         $auth->clearIdentity();
      $this->_redirect('admin/account/redirect');

   }   
0
source share
4 answers

You can always run a javascript onLoad piece that requests another PHP page using AJAX, and then, if the user is logged in, redirects them back to the CPanel or Login page, wherever they are.

A jQuery post will handle this pretty well. http://api.jquery.com/jQuery.post/

+1
source

Browsers can behave differently, so which browser do you use?

, , ? , - , ...

:

    $auth = Zend_Auth::getInstance();
    $auth->clearIdentity();
    $this->_redirect('/identity/login');
+1

,

Zend_Session::destroy();
$this->_helper->redirector('index', 'index');

Zend_Auth , . ( ), ,

0

, , - . , . .

POST when the user goes to a new page. If you click the back button, this will require re-adding the content, but the session will be closed and the request will fail.

0
source

All Articles