authentication : allow logout to provide a url to be displayed after successful logout
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3390 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -79,8 +79,10 @@ class authentication
|
||||
}*/
|
||||
|
||||
/** Disconnect the user
|
||||
* @param string|null $url The url to be redirected after a valid
|
||||
* logout
|
||||
*/
|
||||
public function logout ()
|
||||
public function logout ($url = "")
|
||||
{
|
||||
if ($this->debug) echo "<pre>LOGOUT\n";
|
||||
$authsession = new \authsession ();
|
||||
@@ -91,11 +93,16 @@ class authentication
|
||||
"Logout for '".$param["email"]."'");
|
||||
$authsession->logout ();
|
||||
unset ($_SESSION["domframework"]["authentication"]);
|
||||
$_SESSION["domframework"]["authentication"]["message"] =
|
||||
dgettext("domframework", "You have been logged out");
|
||||
if ($this->debug) echo "Redirect to authentication page";
|
||||
if ($this->debug) $this->route->debug = $this->debug;
|
||||
$this->route->redirect ("/authentication", "");
|
||||
if ($url === "")
|
||||
{
|
||||
$_SESSION["domframework"]["authentication"]["message"] =
|
||||
dgettext("domframework", "You have been logged out");
|
||||
$this->route->redirect ("/authentication", "");
|
||||
}
|
||||
else
|
||||
$this->route->redirect ($url);
|
||||
}
|
||||
|
||||
/** Display the login page
|
||||
@@ -344,9 +351,9 @@ class authentication
|
||||
$authObj = $this;
|
||||
$route=$this->route;
|
||||
$this->route
|
||||
->get ("authentication/logout", function () use ($authObj)
|
||||
->get ("authentication/logout({url})?", function ($url) use ($authObj)
|
||||
{
|
||||
$authObj->logout ();
|
||||
$authObj->logout ($url);
|
||||
})
|
||||
|
||||
->get ("authentication", function () use ($route)
|
||||
|
||||
Reference in New Issue
Block a user