Wrap bcrypt in a try-catch

This commit is contained in:
calzoneman 2013-03-27 15:02:43 -05:00
parent 124ec0080f
commit 448d774b0d
1 changed files with 25 additions and 19 deletions

View File

@ -77,6 +77,7 @@ exports.login = function(name, pw) {
var results = db.querySync(query);
var rows = results.fetchAllSync();
if(rows.length > 0) {
try {
if(bcrypt.compareSync(pw, rows[0].pw)) {
db.closeSync();
return rows[0];
@ -101,5 +102,10 @@ exports.login = function(name, pw) {
return false;
}
}
catch(e) {
Logger.errlog.log("Auth.login fail");
Logger.errlog.log(e);
}
}
return false;
}