Created
September 11, 2014 12:01
-
-
Save tilast/9442a68e278bb24bb143 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post('/signin', function (req, res) { | |
var query = db.userModel.findOne({ 'email': req.body.email }); | |
var pass = ''; | |
query.select('password'); | |
query.exec(function (err, pass) { | |
if (err) return handleError(err); | |
pass = pass.password; | |
console.log('DB pass'+pass); | |
goNext(); | |
}); | |
function goNext() { | |
console.log(pass); | |
if (req.body.hash == pass) { | |
/// req.session.mail = req.body.email; | |
console.log('good login'); | |
} else { | |
//incorect login/pass | |
res.send('password is incorrect'); | |
console.log(2); | |
} | |
res.end('response'); | |
} | |
// В середині модуля не бачить Монгус моделі userModel | |
/* | |
auth.verify(req.body.email,req.body.hash); | |
*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment