Konfi-Castle-Kasino/admin.go

28 lines
448 B
Go
Raw Normal View History

2017-06-15 09:30:32 +00:00
package main
import (
"github.com/labstack/echo"
"net/http"
)
type Loggedin struct {
Loggedin bool
}
2017-06-15 09:30:32 +00:00
func adminHandler (c echo.Context) error {
rw := c.Response()
r := c.Request()
//Session init
sess := GlobalSessions.SessionStart(rw, r)
//Loggedin
loggedin := sess.Get("login")
if loggedin != nil {
return c.Render(http.StatusOK, "admin", Loggedin{true})
} else {
return c.Render(http.StatusOK, "admin", Loggedin{false})
}
2017-06-15 09:30:32 +00:00
}