Logout management (uri: 'logout' ou 'logout/')

This commit is contained in:
xdrm-brackets 2017-01-13 18:17:31 +01:00
parent 59541a9855
commit 8f5f8030e5
1 changed files with 15 additions and 2 deletions

View File

@ -81,6 +81,11 @@
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
$R->get('(.*)', function($m){
@ -98,6 +103,14 @@
/* (3) Si on est pas authentifié */
}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){
if( !preg_match('#^admin/$#', $m[0]) ) header(__REDIRECT__);
else include __PUBLIC__.'/view/admin.php';
@ -116,7 +129,7 @@
/* (4) api/module/method -> Api */
$R->post('api(?:/(.*))/??', function($url){
$R->post('api(?:/(.*))/?', function($url){
$request = ModuleRequest::fromPost($url, $_POST);
$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->post('.+', function(){ header(__REDIRECT__); });