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 +

-

+ Konfi Hinzufügen -
+ Konfis Importieren @@ -113,10 +117,8 @@
-

-
+

Kasino Admin -