mirror of
https://github.com/ngoduykhanh/wireguard-ui
synced 2024-05-19 05:56:38 +02:00
fix
This commit is contained in:
parent
73cd5ae94d
commit
1471c87886
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue