fix(auth): support department subdomains like @aids.ritchennai.edu.in and @cse.ritchennai.edu.in
Some checks failed
Deploy RIT Freshers Hub to VPS / Deploy to Live VPS (push) Has been cancelled
Some checks failed
Deploy RIT Freshers Hub to VPS / Deploy to Live VPS (push) Has been cancelled
This commit is contained in:
@@ -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) {
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default function ProtectedRoute({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
You are signed in as <strong>{user?.email}</strong>. This feature is restricted to verified students with an <strong className="text-[#F97316]">@ritchennai.edu.in</strong> college email.
|
You are signed in as <strong>{user?.email}</strong>. This feature is restricted to verified students with a <strong className="text-[#F97316]">ritchennai.edu.in</strong> college email.
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user