update: better CSS border colors
This commit is contained in:
@ -8,49 +8,49 @@ import (
|
||||
)
|
||||
|
||||
func MiddleAuth(c *fiber.Ctx) error {
|
||||
cookie := c.Cookies("auth")
|
||||
cookie := c.Cookies("auth")
|
||||
|
||||
if cookie == "" {
|
||||
return c.Redirect("/login")
|
||||
}
|
||||
if cookie == "" {
|
||||
return c.Redirect("/login")
|
||||
}
|
||||
|
||||
users, err := lib.LoadUsers()
|
||||
if err != nil {
|
||||
log.Printf("Failed to load users: %s", err.Error())
|
||||
return lib.RenderError(c, 500)
|
||||
}
|
||||
users, err := lib.LoadUsers()
|
||||
if err != nil {
|
||||
log.Printf("Failed to load users: %s", err.Error())
|
||||
return lib.RenderError(c, 500)
|
||||
}
|
||||
|
||||
for _, u := range users {
|
||||
if u.Cookie == "notset" || u.Cookie == "" {
|
||||
continue
|
||||
}
|
||||
for _, u := range users {
|
||||
if u.Cookie == "notset" || u.Cookie == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
if cookie == u.Cookie {
|
||||
return c.Next()
|
||||
}
|
||||
}
|
||||
if cookie == u.Cookie {
|
||||
return c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
c.ClearCookie("auth")
|
||||
return c.Redirect("/login")
|
||||
c.ClearCookie("auth")
|
||||
return c.Redirect("/login")
|
||||
}
|
||||
|
||||
func GETManage(c *fiber.Ctx) error {
|
||||
return c.Render("manage", fiber.Map{})
|
||||
return c.Render("manage", fiber.Map{})
|
||||
}
|
||||
|
||||
func GETLogout(c *fiber.Ctx) error {
|
||||
user, err := lib.GetUser(c)
|
||||
if err != nil {
|
||||
log.Printf("Failed to load user: %s", err.Error())
|
||||
return lib.RenderError(c, 500)
|
||||
}
|
||||
user, err := lib.GetUser(c)
|
||||
if err != nil {
|
||||
log.Printf("Failed to load user: %s", err.Error())
|
||||
return lib.RenderError(c, 500)
|
||||
}
|
||||
|
||||
user.Cookie = "notset"
|
||||
err = lib.UpdateUser(user)
|
||||
if err != nil {
|
||||
log.Printf("Failed to save users: %s", err.Error())
|
||||
return lib.RenderError(c, 500)
|
||||
}
|
||||
user.Cookie = "notset"
|
||||
err = lib.UpdateUser(user)
|
||||
if err != nil {
|
||||
log.Printf("Failed to save users: %s", err.Error())
|
||||
return lib.RenderError(c, 500)
|
||||
}
|
||||
|
||||
return c.Redirect("/login")
|
||||
return c.Redirect("/login")
|
||||
}
|
||||
|
Reference in New Issue
Block a user