Skip to content

Commit

Permalink
added user email verification before sending email
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushSharma72 committed Oct 31, 2024
1 parent 5fa40fc commit 2e145b1
Show file tree
Hide file tree
Showing 5 changed files with 1,129 additions and 59 deletions.
2 changes: 1 addition & 1 deletion backend/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MONGODB_URL = mongodb://127.0.0.1:27017/
MONGODB_URL = "mongodb://127.0.0.1:27017/Ayush"
JWT_SECRET = "MYSECRET"
PORT = 4000
21 changes: 21 additions & 0 deletions backend/controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,25 @@ router.post("/signup", async (req, res) => {
}
});

router.post("/userexits", async (req, resp) => {
try {
const { email } = req.body;
const userexist = await User.findOne({ email });

if (userexist) {
return resp.status(200).send({
exist: true,
});
}
return resp.status(200).send({
exist: false,
});
} catch (error) {
return resp.status(500).send({
success: false,
message: "internal server error",
});
}
});

module.exports = router;
Loading

0 comments on commit 2e145b1

Please sign in to comment.