Konfi-Castle-Kasino/admin.go

28 lines
447 B
Go

package main
import (
"github.com/labstack/echo"
"net/http"
)
type Loggedin struct {
Loggedin bool
}
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})
}
}