Removed console log
parent
f26c3b37e0
commit
ddbaac904c
|
@ -88,40 +88,28 @@ func getUserSessionExpiresTime() time.Time {
|
|||
func SessionIdCheck(c *fiber.Ctx) error {
|
||||
var sessionId string
|
||||
|
||||
log.Info("query", c.Method())
|
||||
|
||||
if c.Method() == "GET" {
|
||||
log.Infoln("q", c.Query("session_id"))
|
||||
sessionId = c.Query(cfg.Settings.Cookies.SessionId)
|
||||
} else {
|
||||
sessionId = c.Cookies(cfg.Settings.Cookies.SessionId)
|
||||
}
|
||||
|
||||
log.Debugln("SessionIdCheck", sessionId)
|
||||
|
||||
if sessionId == "" {
|
||||
return fiber.ErrUnauthorized
|
||||
}
|
||||
log.Infoln("sess", sessionId)
|
||||
|
||||
valid := isSessionIdValid(sessionId)
|
||||
|
||||
if valid {
|
||||
return c.Next()
|
||||
}
|
||||
|
||||
log.Info("unauth")
|
||||
return fiber.ErrUnauthorized
|
||||
}
|
||||
|
||||
func AuthSession(c *fiber.Ctx) error {
|
||||
sessionId := c.Cookies(cfg.Settings.Cookies.SessionId)
|
||||
|
||||
log.Infoln("cookie", sessionId, c.IP())
|
||||
|
||||
auth := c.Get(fiber.HeaderAuthorization)
|
||||
|
||||
log.Infoln("auth", auth, c.Get("credentials"))
|
||||
|
||||
if sessionId == "" {
|
||||
return fiber.ErrUnauthorized
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue