forked from CSI-KJSCE/appointment_to_examiner
Fixes for Admin Login, @somaiya.edu validation, and Password Visibility
This commit is contained in:
@@ -13,6 +13,14 @@ passport.use(
|
||||
},
|
||||
async (accessToken, refreshToken, profile, done) => {
|
||||
try {
|
||||
// Security: Check if the email is from Somaiya
|
||||
// We only want somaiya students/faculty to access this
|
||||
if (profile.emails[0].value.endsWith("@somaiya.edu") === false) {
|
||||
return done(null, false, {
|
||||
message: "Only @somaiya.edu emails are allowed",
|
||||
});
|
||||
}
|
||||
|
||||
// Check if a user with the same email already exists
|
||||
let user = await User.findOne({ email: profile.emails[0].value });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user