Commit b9bde2f5 authored by varsha's avatar varsha
Browse files

Update index.js

parent d0d26139
Pipeline #31724 passed with stage
in 14 seconds
......@@ -103,16 +103,28 @@ router.post('/customer_registration', function (req, res, next) {
Email:email,
Password:password
}
Farmer.create(newlist,function(err,newone){
Customer.findOne({username: req.body.uname}, function(err,uname) // checked where the entered username is already in customers list
{
if(uname)
{
res.send('A customer is already having this username please enter another username');
}
else
{
Customer.create(newlist,function(err,newlyCreated)
{
if (err)
{
console.log(err);
console.log(err);
}
else
{
res.redirect("/");
}
});
}
});
});
module.exports = router;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment