This commit is contained in:
alikhanich 2023-03-17 09:23:42 +03:00
parent 73cd5ae94d
commit 1471c87886

View file

@ -23,22 +23,6 @@ func ValidSession(next echo.HandlerFunc) echo.HandlerFunc {
}
}
func ProtectedHandler(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
sess, err := session.Get("session", c)
if err != nil {
return err
}
apiKey, ok := sess.Values["api_key"].(string)
if !ok || apiKey != util.ApiKey {
return echo.NewHTTPError(http.StatusUnauthorized, "Invalid API key")
}
// Handle the request for authenticated users
return next(c)
}
}
func isValidSession(c echo.Context) bool {
if util.DisableLogin {
return true