aboutsummaryrefslogtreecommitdiff
path: root/app/class/controllerconnect.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/class/controllerconnect.php')
-rw-r--r--app/class/controllerconnect.php52
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');
+ }
+ }
+
+
+
}