Logout management (uri: 'logout' ou 'logout/')
This commit is contained in:
parent
59541a9855
commit
8f5f8030e5
|
@ -81,6 +81,11 @@
|
||||||
if( $auth == 2 ){
|
if( $auth == 2 ){
|
||||||
|
|
||||||
|
|
||||||
|
// logout from admin
|
||||||
|
$R->get('logout/?', function(){
|
||||||
|
(new ModuleRequest('authentificationDefault/admin', ['username' => '0', 'password' => '']))->dispatch();
|
||||||
|
header('Location: /');
|
||||||
|
});
|
||||||
|
|
||||||
// nomPage/arg1/arg2 -> inclusion de la page
|
// nomPage/arg1/arg2 -> inclusion de la page
|
||||||
$R->get('(.*)', function($m){
|
$R->get('(.*)', function($m){
|
||||||
|
@ -98,6 +103,14 @@
|
||||||
/* (3) Si on est pas authentifié */
|
/* (3) Si on est pas authentifié */
|
||||||
}else if( $auth == 1 ){
|
}else if( $auth == 1 ){
|
||||||
|
|
||||||
|
// warehouse logout
|
||||||
|
$R->get('logout/?', function(){
|
||||||
|
(new ModuleRequest('authentificationDefault/warehouse', ['name' => '000', 'password' => '']))->dispatch();
|
||||||
|
header('Location: /');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// admin login page
|
||||||
$R->get('(.*)', function($m){
|
$R->get('(.*)', function($m){
|
||||||
if( !preg_match('#^admin/$#', $m[0]) ) header(__REDIRECT__);
|
if( !preg_match('#^admin/$#', $m[0]) ) header(__REDIRECT__);
|
||||||
else include __PUBLIC__.'/view/admin.php';
|
else include __PUBLIC__.'/view/admin.php';
|
||||||
|
@ -116,7 +129,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* (4) api/module/method -> Api */
|
/* (4) api/module/method -> Api */
|
||||||
$R->post('api(?:/(.*))/??', function($url){
|
$R->post('api(?:/(.*))/?', function($url){
|
||||||
$request = ModuleRequest::fromPost($url, $_POST);
|
$request = ModuleRequest::fromPost($url, $_POST);
|
||||||
$answer = $request->dispatch();
|
$answer = $request->dispatch();
|
||||||
|
|
||||||
|
@ -128,7 +141,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/* (5) N'importe -> page d'accueil */
|
/* (6) N'importe -> page d'accueil */
|
||||||
$R->get('.+', function(){ header(__REDIRECT__); });
|
$R->get('.+', function(){ header(__REDIRECT__); });
|
||||||
$R->post('.+', function(){ header(__REDIRECT__); });
|
$R->post('.+', function(){ header(__REDIRECT__); });
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue