Skip to content

Commit a21996b

Browse files
committed
Email Check
1 parent e8c3cf3 commit a21996b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

controllers/auth.controller.js

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ const jwt = require('../utils/jwt');
55
const bcrypt = require('bcrypt');
66

77
exports.register = async (req, res) => {
8+
const isExist = await User.findOne({
9+
where:{
10+
email: req.body.email
11+
}
12+
})
13+
if(isExist) {
14+
return res.status(400).json({ error: 'Email already exists.' });
15+
}
816
const hashedPassword = await bcrypt.hash(req.body.password, 10);
917

1018
const user = await User.create({

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)