Vra

I need to have my web app destroy/unset the Zend_Auth session when a user leaves the site: for example when a user navigates away from myapp.com to say google.com, when they come back the session is no longer set?

Preferable to allow refresh without unsetting (but not essential as the first part must apply).

Anyone had experience with doing this before?

Was dit nuttig?

Oplossing

Make an ajax call before unloading the page, that clears the identity of the Zend Auth

<script language="JavaScript">
        window.onbeforeunload = function(){
        $.get('http://example.com/auth/clear');
    }
</script>

ServerSide:

public function clearAction(){
    Zend_Auth::getInstance()->clearIdentity();
}
Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top