Skip to content
Merged
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/controllers/auth.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ async function login(req, res, next) {
const { email, password } = req.body;
const user = await User.findOne({ email });
if (!user) {
return res.json({ loginStatus: false, Error: 'Invalid Credentials' });
return res.status(401).json({ loginStatus: false, Error: 'Invalid Credentials' });
}
const match = await bycrypt.compare(password, user.password);
if (!match) {
return res.json({ loginStatus: false, Error: 'Invalid Credentials' });
return res.status(401).json({ loginStatus: false, Error: 'Invalid Credentials' });
}
const token = jwt.sign({ id: user._id, email: user.email }, process.env.JWT_SECRET, { expiresIn: '1d' });
res.cookie('token', token, cookieOptions);
Expand Down
Loading