From cf024b1ba2ad5e436085183bf4bb0605853cb853 Mon Sep 17 00:00:00 2001 From: Sarthak90210 Date: Fri, 20 Nov 2026 15:15:10 +0530 Subject: [PATCH] fix: don't require SERVERID cookie for a valid VTOP session VTOP no longer sets a SERVERID cookie; only JSESSIONID is returned. ValidateCookies, the login validator and the semester-details check still required SERVERID, so every successful login was discarded and users saw "Unable to log in" even with correct credentials. Treat a session as valid when CSRF and JSESSIONID are present. --- helpers/helper.go | 2 +- helpers/login-validator.go | 2 +- helpers/sem-details.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helpers/helper.go b/helpers/helper.go index 444064b..cd0e4e4 100644 --- a/helpers/helper.go +++ b/helpers/helper.go @@ -384,7 +384,7 @@ func SanitizeString(input string) string { } func ValidateCookies(cookies types.Cookies) bool { - return cookies.CSRF != "" && cookies.JSESSIONID != "" && cookies.SERVERID != "" + return cookies.CSRF != "" && cookies.JSESSIONID != "" } func ExtractRowData(rowSelection *goquery.Selection) []string { diff --git a/helpers/login-validator.go b/helpers/login-validator.go index 5f8e43b..0b8b460 100644 --- a/helpers/login-validator.go +++ b/helpers/login-validator.go @@ -8,7 +8,7 @@ import ( // ValidateLogin checks if the user is logged in by validating the cookies // Returns true if the user is logged in, otherwise prints a message and returns false func ValidateLogin(cookies types.Cookies) bool { - if cookies.CSRF == "" || cookies.JSESSIONID == "" || cookies.SERVERID == "" { + if cookies.CSRF == "" || cookies.JSESSIONID == "" { StopHeadlineForOutput() fmt.Println("Please login first using the cli-top login command") return false diff --git a/helpers/sem-details.go b/helpers/sem-details.go index 1134eb9..592d094 100644 --- a/helpers/sem-details.go +++ b/helpers/sem-details.go @@ -52,7 +52,7 @@ func GetSemDetails(cookies types.Cookies, regNo string) ([]types.Semester, error if cached, ok := getCachedSemesters(regNo); ok { return cached, nil } - if cookies.CSRF == "" || cookies.JSESSIONID == "" || cookies.SERVERID == "" { + if cookies.CSRF == "" || cookies.JSESSIONID == "" { return nil, fmt.Errorf("please login first using the cli-top login command") } endpoints := []string{