Skip to content

Commit bf83413

Browse files
authored
Trap a potential error (#1448)
* Removed WARNING comment as it's now trapped Post #604 Auto-merge
1 parent 982b5eb commit bf83413

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

controllers/auth.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,15 @@ exports.auth = function (aReq, aRes, aNext) {
149149

150150
User.findOne({ name: { $regex: new RegExp('^' + username + '$', 'i') } },
151151
function (aErr, aUser) {
152-
// WARNING: No error handling at this stage
153152
var strategies = null;
154153
var strat = null;
155154

155+
if (aErr) {
156+
console.error('Authfail with no User found of', username, aErr);
157+
aRes.redirect('/login?usernamefail');
158+
return;
159+
}
160+
156161
if (aUser) {
157162
// Ensure that casing is identical so we still have it, correctly, when they
158163
// get back from authentication

0 commit comments

Comments
 (0)