route : allow the 401 error code to be redirected to an external URL to authenticate the user
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2237 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -28,6 +28,9 @@ class route
|
|||||||
public $errors = null;
|
public $errors = null;
|
||||||
/** Preroute used in modules */
|
/** Preroute used in modules */
|
||||||
public $preroute = "";
|
public $preroute = "";
|
||||||
|
/** Authentication URL used if a 401 error is raised. If none is defined,
|
||||||
|
just display a "Unauthorized" message */
|
||||||
|
public $authenticationURL = null;
|
||||||
|
|
||||||
/** Return the baseURL of the site
|
/** Return the baseURL of the site
|
||||||
Always finish with a slash
|
Always finish with a slash
|
||||||
@@ -456,6 +459,12 @@ class route
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->authenticationURL !== null && $getCode === 401)
|
||||||
|
{
|
||||||
|
// Non autorized users should be authenticated
|
||||||
|
$this->redirect ($this->authenticationURL.$this->requestURL(), "");
|
||||||
|
}
|
||||||
|
|
||||||
$http = new http ();
|
$http = new http ();
|
||||||
@header ($_SERVER["SERVER_PROTOCOL"]." $getCode ".
|
@header ($_SERVER["SERVER_PROTOCOL"]." $getCode ".
|
||||||
$http->codetext ($getCode));
|
$http->codetext ($getCode));
|
||||||
|
|||||||
Reference in New Issue
Block a user