diff --git a/authentication.php b/authentication.php index e82a625..59ef1d3 100644 --- a/authentication.php +++ b/authentication.php @@ -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 "
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)