diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-11-12 13:55:40 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-11-12 13:55:40 +0100 |
commit | e4768cd0647d934eff424f73bfd9f5c8f6223c94 (patch) | |
tree | b36029a8152d79108e0dd57aacd73f80b7232b33 /app/class/controllerconnect.php | |
parent | 0f44c6d918a2932b68019c02de5bc55e7057600a (diff) | |
download | wcms-e4768cd0647d934eff424f73bfd9f5c8f6223c94.tar.gz wcms-e4768cd0647d934eff424f73bfd9f5c8f6223c94.zip |
link+log
Diffstat (limited to 'app/class/controllerconnect.php')
-rw-r--r-- | app/class/controllerconnect.php | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/app/class/controllerconnect.php b/app/class/controllerconnect.php index 2bda1b0..da3c96f 100644 --- a/app/class/controllerconnect.php +++ b/app/class/controllerconnect.php @@ -3,11 +3,59 @@ class Controllerconnect extends Controller { - public function desktop() + public function log() { - $this->showtemplate('connect', ['user' => $this->user]); + if (isset($_POST['log'])) { + if (isset($_POST['id'])) { + $id = $_POST['id']; + } else { + $id = null; + } + if ($_POST['log'] === 'login') { + $this->login($id); + } elseif ($_POST['log'] === 'logout') { + $this->logout($id); + } + } + + } + + + public function connect() + { + $this->showtemplate('connect', []); } + + + + + public function login($id) + { + if (isset($_POST['pass'])) { + $this->user = $this->usermanager->login($_POST['pass']); + $this->usermanager->writesession($this->user); + } + if (!empty($id)) { + $this->routedirect('artedit', ['art' => $id]); + } else { + $this->routedirect('backrouter'); + } + } + + public function logout($id) + { + $this->user = $this->usermanager->logout(); + $this->usermanager->writesession($this->user); + if (!empty($id)) { + $this->routedirect('artread/', ['art' => $id]); + } else { + $this->routedirect('backrouter'); + } + } + + + } |