Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/config/passportConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ passport.use(
try {
const user = await User.findOne( {email} );
if (!user) {
return done(null, false, { message: 'Email is invalid '});
return done(null, false, { message: 'Email is invalid ' });
}

const isMatch = await user.comparePassword(password);
Expand All @@ -18,7 +18,7 @@ passport.use(
}

return done(null, {
id : user._id.toString(),
id: user._id.toString(),
username: user.username,
email: user.email
});
Expand Down
6 changes: 6 additions & 0 deletions backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ app.use(cors({

// Middleware
app.use(bodyParser.json());

app.use(session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: false,
cookie: {
maxAge: 24 * 60 * 60 * 1000,
secure: process.env.NODE_ENV === "production",
sameSite: process.env.NODE_ENV === "production" ? "none" : "lax"
}
}));
app.use(passport.initialize());
app.use(passport.session());
Expand Down