fix(skillrack): update PROFILE_URL to manageprofile.xhtml (fixing 404 error) and simplify auth failure check
Some checks failed
Deploy RIT Freshers Hub to VPS / Deploy to Live VPS (push) Has been cancelled

This commit is contained in:
Shanmuga Krishnan S M
2026-08-28 09:48:50 +05:30
parent db5ac8e2ea
commit f368c83246

View File

@@ -30,8 +30,8 @@ public class SkillrackService {
// AES-128 key (16 bytes) — in production, move to environment variable // AES-128 key (16 bytes) — in production, move to environment variable
private static final String AES_KEY = "RitSkillR@ck2026"; private static final String AES_KEY = "RitSkillR@ck2026";
private static final String SKILLRACK_BASE = "https://www.skillrack.com"; private static final String SKILLRACK_BASE = "https://www.skillrack.com";
private static final String LOGIN_URL = SKILLRACK_BASE + "/faces/candidate/profileview.xhtml"; private static final String LOGIN_URL = SKILLRACK_BASE + "/faces/ui/profile.xhtml";
private static final String PROFILE_URL = SKILLRACK_BASE + "/faces/candidate/profileview.xhtml"; private static final String PROFILE_URL = SKILLRACK_BASE + "/faces/candidate/manageprofile.xhtml";
// ─── Public API ─────────────────────────────────────────────────── // ─── Public API ───────────────────────────────────────────────────
@@ -127,23 +127,10 @@ public class SkillrackService {
Document profileDoc = profileRes.parse(); Document profileDoc = profileRes.parse();
String bodyText = profileDoc.body().text(); String bodyText = profileDoc.body().text();
// Check if login failed (still redirected back to login page containing Login Id input) // Check if login failed (still on login page containing j_security_check form)
if (bodyText.contains("Login Id") || bodyText.contains("Invalid") || !bodyText.contains("Candidate")) { if (bodyText.contains("j_security_check") || bodyText.contains("Invalid User ID")) {
// Try alternative candidate manage profile page log.warn("SkillRack authentication failed for: {}", profile.getSkillrackEmail());
Connection.Response dashRes = Jsoup.connect(SKILLRACK_BASE + "/faces/candidate/manageprofile.xhtml") return false;
.method(Connection.Method.GET)
.cookies(cookies)
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36")
.followRedirects(true)
.timeout(15000)
.execute();
cookies.putAll(dashRes.cookies());
Document dashDoc = dashRes.parse();
String dashText = dashDoc.body().text();
if (!dashText.contains("Login Id")) {
profileDoc = dashDoc;
bodyText = dashText;
}
} }
// Step 4: Parse profile stats from the HTML // Step 4: Parse profile stats from the HTML