From 84106409fbc32da45b208ec7b22756af38c6ba43 Mon Sep 17 00:00:00 2001 From: konrad Date: Fri, 28 Jul 2017 15:04:02 +0200 Subject: [PATCH] =?UTF-8?q?logout=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- logout.go | 18 ++++++++++++++++++ main.go | 1 + tpl/admin.html | 12 +++++++----- 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 logout.go diff --git a/README.md b/README.md index a26f8e5..8199e28 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,6 @@ TODO:: * ~~Manuell (einzeln)~~ * CSV-Import * ~~Kofis löschen~~ -* Logout +* Konfis auf der Frontseite mit Websockets updaten +* ~~Logout~~ +* Mode hinzufügen: in der Config soll man zwischen Gemeinden und Konfis umschalten können, so dass entweder die Gemeinden oder Konfis gegeneinander spielen \ No newline at end of file diff --git a/logout.go b/logout.go new file mode 100644 index 0000000..95b0387 --- /dev/null +++ b/logout.go @@ -0,0 +1,18 @@ +package main + +import ( + "github.com/labstack/echo" + "net/http" +) + +func logout(c echo.Context) error { + rw := c.Response() + r := c.Request() + + //Session auf nil setzen zum ausloggen + sess := GlobalSessions.SessionStart(rw, r) + sess.Set("login", nil) + + //Auf die adminseite weiterleiten + return c.Redirect(http.StatusSeeOther, "/admin") +} diff --git a/main.go b/main.go index b0eb400..df512f1 100644 --- a/main.go +++ b/main.go @@ -63,6 +63,7 @@ func main() { e.GET("/", showList) e.GET("/list", getList) e.GET("/admin", adminHandler) + e.GET("/logout", logout) e.POST("/login", login) e.POST("/update", update) diff --git a/tpl/admin.html b/tpl/admin.html index 40772c1..cf48c30 100644 --- a/tpl/admin.html +++ b/tpl/admin.html @@ -12,11 +12,15 @@

Kasino Admin

+ + + Ausloggen +

-

+ Konfis Importieren @@ -113,10 +117,8 @@
-

-
+

Kasino Admin -