mirror of
https://github.com/Xevion/scla-unsubscribe.git
synced 2025-12-15 04:13:11 -06:00
Make second request for logout btn check
This commit is contained in:
12
directory.go
12
directory.go
@@ -92,6 +92,18 @@ func Login(username string, password string) error {
|
||||
log.Info().Str("authCookie", authCookie).Msg("Auth Cookie Found")
|
||||
}
|
||||
|
||||
// Check if redirected to directory page
|
||||
if response.Header.Get("Location") != "" {
|
||||
log.Debug().Str("location", response.Header.Get("Location")).Msg("Redirected")
|
||||
} else {
|
||||
return fmt.Errorf("login failed: no redirect")
|
||||
}
|
||||
|
||||
// Request the redirect page
|
||||
request, _ = http.NewRequest("GET", fmt.Sprintf("%s%s", "https://www.utsa.edu", response.Header.Get("Location")), nil)
|
||||
ApplyUtsaHeaders(request)
|
||||
response, body, err = DoRequest(request)
|
||||
|
||||
doc, err = goquery.NewDocumentFromReader(strings.NewReader(string(body)))
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing response body")
|
||||
|
||||
Reference in New Issue
Block a user