|
@@ -141,11 +141,6 @@ module.exports = {
|
|
|
return res.redirect("/");
|
|
return res.redirect("/");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(!this.isUniqueEmail){
|
|
|
|
|
- req.session.error = "Email already in use";
|
|
|
|
|
- return res.redirect("/");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
axios.get(`https://apisandbox.dev.clover.com/v3/merchants/${req.session.posId}?access_token=${token}`)
|
|
axios.get(`https://apisandbox.dev.clover.com/v3/merchants/${req.session.posId}?access_token=${token}`)
|
|
|
.then((cloverMerchant)=>{
|
|
.then((cloverMerchant)=>{
|
|
|
req.session.posId = undefined;
|
|
req.session.posId = undefined;
|
|
@@ -233,11 +228,6 @@ module.exports = {
|
|
|
return res.redirect("/");
|
|
return res.redirect("/");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(!this.isUniqueEmail){
|
|
|
|
|
- req.session.error = "Email already in use";
|
|
|
|
|
- return res.redirect("/");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
let salt = bcrypt.genSaltSync(10);
|
|
let salt = bcrypt.genSaltSync(10);
|
|
|
let hash = bcrypt.hashSync(data.password, salt);
|
|
let hash = bcrypt.hashSync(data.password, salt);
|
|
|
|
|
|
|
@@ -618,19 +608,5 @@ module.exports = {
|
|
|
|
|
|
|
|
return res.json(errorMessage);
|
|
return res.json(errorMessage);
|
|
|
});
|
|
});
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- //Helper
|
|
|
|
|
- isUniqueEmail: function(email){
|
|
|
|
|
- Merchant.findOne({email: email})
|
|
|
|
|
- .then((merchant)=>{
|
|
|
|
|
- if(merchant){
|
|
|
|
|
- return false;
|
|
|
|
|
- }else{
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- return false;
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|