mirror of https://github.com/calzoneman/sync.git
Wrap bcrypt in a try-catch
This commit is contained in:
parent
124ec0080f
commit
448d774b0d
6
auth.js
6
auth.js
|
@ -77,6 +77,7 @@ exports.login = function(name, pw) {
|
||||||
var results = db.querySync(query);
|
var results = db.querySync(query);
|
||||||
var rows = results.fetchAllSync();
|
var rows = results.fetchAllSync();
|
||||||
if(rows.length > 0) {
|
if(rows.length > 0) {
|
||||||
|
try {
|
||||||
if(bcrypt.compareSync(pw, rows[0].pw)) {
|
if(bcrypt.compareSync(pw, rows[0].pw)) {
|
||||||
db.closeSync();
|
db.closeSync();
|
||||||
return rows[0];
|
return rows[0];
|
||||||
|
@ -101,5 +102,10 @@ exports.login = function(name, pw) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(e) {
|
||||||
|
Logger.errlog.log("Auth.login fail");
|
||||||
|
Logger.errlog.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue