diff --git a/backend/src/main/java/com/rit/portal/service/GoogleAuthService.java b/backend/src/main/java/com/rit/portal/service/GoogleAuthService.java index 83a4bde..6245feb 100644 --- a/backend/src/main/java/com/rit/portal/service/GoogleAuthService.java +++ b/backend/src/main/java/com/rit/portal/service/GoogleAuthService.java @@ -89,10 +89,13 @@ public class GoogleAuthService { } /** - * Returns true if the email belongs to the college domain. + * Returns true if the email belongs to the college domain or any department subdomain + * e.g., @ritchennai.edu.in, @aids.ritchennai.edu.in, @cse.ritchennai.edu.in, etc. */ public boolean isCollegeDomain(String email) { - return email != null && email.toLowerCase().endsWith("@" + COLLEGE_DOMAIN); + if (email == null) return false; + String lower = email.toLowerCase().trim(); + return lower.endsWith("ritchennai.edu.in"); } /** diff --git a/src/components/Auth/ProtectedRoute.tsx b/src/components/Auth/ProtectedRoute.tsx index 6a61131..6e71ae1 100644 --- a/src/components/Auth/ProtectedRoute.tsx +++ b/src/components/Auth/ProtectedRoute.tsx @@ -69,7 +69,7 @@ export default function ProtectedRoute({ ) : ( <> - You are signed in as {user?.email}. This feature is restricted to verified students with an @ritchennai.edu.in college email. + You are signed in as {user?.email}. This feature is restricted to verified students with a ritchennai.edu.in college email. )}