Skip to content
Open
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
6 changes: 3 additions & 3 deletions routes/api/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ router.post("/register", (req, res) => {
return res.status(400).json(errors);
}

User.findOne({ email: req.body.email }).then(user => {
User.findOne({ email: req.body.email.toLowerCase() }).then(user => {
if (user) {
return res.status(400).json({ email: "Email already exists" });
} else {
const newUser = new User({
name: req.body.name,
email: req.body.email,
email: req.body.email.toLowerCase(),
password: req.body.password
});

Expand Down Expand Up @@ -63,7 +63,7 @@ router.post("/login", (req, res) => {
return res.status(400).json(errors);
}

const email = req.body.email;
const email = req.body.email.toLowerCase();
const password = req.body.password;

// Find user by email
Expand Down