fix some artifact serialization trouble; fix login error

This commit is contained in:
mntmn
2018-04-15 00:23:52 +02:00
parent f396bc2e40
commit c5783feca9
8 changed files with 28 additions and 29 deletions

View File

@@ -26,9 +26,10 @@ router.post('/', function(req, res) {
//res.status(400).json({"error":"session.users"});
})
.then(user => {
console.log("!!! user: ",user.password_hash);
if (bcrypt.compareSync(password, user.password_hash)) {
if (!user) {
res.sendStatus(404);
}
else if (bcrypt.compareSync(password, user.password_hash)) {
crypto.randomBytes(48, function(ex, buf) {
var token = buf.toString('hex');
console.log("!!! token: ",token);