aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/admin/LogoutController.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-05-22 13:20:31 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commit2899ebb5b5e82890c877151f5c02045266ac9973 (patch)
tree0c4e2684c7f6d161f92a21181bfa4b2f78d6a82f /application/front/controller/admin/LogoutController.php
parentaf290059d10319e76d1e7d78b592cab99c26d91a (diff)
downloadShaarli-2899ebb5b5e82890c877151f5c02045266ac9973.tar.gz
Shaarli-2899ebb5b5e82890c877151f5c02045266ac9973.tar.zst
Shaarli-2899ebb5b5e82890c877151f5c02045266ac9973.zip
Initialize admin Slim controllers
- Reorganize visitor controllers - Fix redirection with Slim's requests base path - Fix daily links
Diffstat (limited to 'application/front/controller/admin/LogoutController.php')
-rw-r--r--application/front/controller/admin/LogoutController.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/application/front/controller/admin/LogoutController.php b/application/front/controller/admin/LogoutController.php
new file mode 100644
index 00000000..41e81984
--- /dev/null
+++ b/application/front/controller/admin/LogoutController.php
@@ -0,0 +1,29 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Shaarli\Front\Controller\Admin;
6
7use Shaarli\Security\LoginManager;
8use Slim\Http\Request;
9use Slim\Http\Response;
10
11/**
12 * Class LogoutController
13 *
14 * Slim controller used to logout the user.
15 * It invalidates page cache and terminate the user session. Then it redirects to the homepage.
16 */
17class LogoutController extends ShaarliAdminController
18{
19 public function index(Request $request, Response $response): Response
20 {
21 $this->container->pageCacheManager->invalidateCaches();
22 $this->container->sessionManager->logout();
23
24 // TODO: switch to a simple Cookie manager allowing to check the session, and create mocks.
25 setcookie(LoginManager::$STAY_SIGNED_IN_COOKIE, 'false', 0, $this->container->webPath);
26
27 return $response->withRedirect('./');
28 }
29}