brunel/handlers/auth/isloggedin.go
2024-07-30 20:36:04 +01:00

16 lines
313 B
Go

package handlers_auth
import (
"brunel/auth"
"github.com/gofiber/fiber/v2"
)
func IsLoggedIn(c *fiber.Ctx) error {
ok, _ := auth.CheckSessionToken(c.Cookies("pt"))
if !ok {
return c.Status(fiber.StatusUnauthorized).SendString("Unauthorized")
}
return c.Status(fiber.StatusOK).SendString("Logged in")
}