From 55fc826f9827dd86427534c11594c0d9c4f0b8d1 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Mon, 25 May 2020 17:05:08 +0200 Subject: add /login and /logout close #117 --- app/class/Controllerpage.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'app/class/Controllerpage.php') diff --git a/app/class/Controllerpage.php b/app/class/Controllerpage.php index c7e1f98..e864dd3 100644 --- a/app/class/Controllerpage.php +++ b/app/class/Controllerpage.php @@ -311,6 +311,25 @@ class Controllerpage extends Controller $this->routedirect('home'); } + public function logout(string $id) + { + if (!$this->user->isvisitor()) { + $this->disconnect(); + $this->routedirect('pageread', ['page' => $id]); + } else { + $this->routedirect('pageread/', ['page' => $id]); + } + } + + public function login(string $id) + { + if ($this->user->isvisitor()) { + $this->showtemplate('connect', ['id' => $id, 'route' => 'pageread/']); + } else { + $this->routedirect('pageread/', ['page' => $id]); + } + } + public function delete($id) { $this->setpage($id, 'pagedelete'); -- cgit v1.2.3