Skip to content
Snippets Groups Projects
Commit aae4119e authored by Jesus Galaz's avatar Jesus Galaz
Browse files

Deleting any king of console.log vulnerabilities

parent caa0834c
No related branches found
No related tags found
1 merge request!6Adding toDo app functionability
Pipeline #15722 passed
This commit is part of merge request !6. Comments created here will be created in the context of that merge request.
......@@ -31,25 +31,21 @@ router.post('/register', async (req, res) => {
// LogIn User
router.post('/login', async (req, res) => {
const { username, password } = req.body;
console.log('Attempting to log in:', username);
try {
const user = await User.findOne({ username });
console.log('User found:', user);
if (!user) {
return res.status(400).json({ error: 'Invalid username or password' });
}
const isMatch = await bcrypt.compare(password, user.password);
console.log('Password match:', isMatch);
if (!isMatch) {
return res.status(400).json({ error: 'Invalid username or password' });
}
req.session.user = { id: user._id, username: user.username };
console.log('User logged in:', req.session.user);
res.json({ success: true, message: 'Login successful' });
} catch (error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment