Skip to content

Commit

Permalink
Adding more debugging again
Browse files Browse the repository at this point in the history
  • Loading branch information
COMTOP1 committed Jan 6, 2025
1 parent 40f1a7e commit c90e8bc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/views/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,41 +264,48 @@ func (v *Views) Authenticated(next echo.HandlerFunc) echo.HandlerFunc {
log.Printf("failed to create new get token request: %+v", err)
goto login
}
fmt.Println(2.1)

for _, cookie := range c.Request().Cookies() {
req.AddCookie(cookie)
}
fmt.Println(2.2)

resp, err = client.Do(req)
if err != nil {
log.Printf("failed to do client for get token: %+v", err)
goto login
}
fmt.Println(2.3)
defer resp.Body.Close()

b, err = io.ReadAll(resp.Body)
if err != nil {
log.Printf("failed to read get token body: %+v", err)
goto login
}
fmt.Println(2.4)

err = json.Unmarshal(b, &t)
if err != nil {
log.Printf("failed to unmarshal JSON for get token: %+v", err)
goto login
}
fmt.Println(2.5)

fmt.Println(t)

if t.Token == "" {
goto login
}
fmt.Println(2.6)

fmt.Println(resp.StatusCode)

if resp.StatusCode != 201 {
goto login
}
fmt.Println(2.7)

session.Values["token"] = t.Token

Expand All @@ -307,6 +314,7 @@ func (v *Views) Authenticated(next echo.HandlerFunc) echo.HandlerFunc {
log.Printf("failed to save token session for authentication: %+v", err)
goto login
}
fmt.Println(2.8)
return next(c)

login:
Expand Down

0 comments on commit c90e8bc

Please sign in to comment.