Skip to content

Commit eddf8a3

Browse files
committed
Fix uncaught exception for non-existent user
Since we added user management it's possible to get non-existent users which can cause a crash of the Backend server. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
1 parent a40dcdd commit eddf8a3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/web/auth/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ passport.deserializeUser(function (id, done) {
2121
id: id
2222
}
2323
}).then(function (user) {
24+
// Don't die on non-existent user
25+
if (user == null) {
26+
return done(null, false, { message: 'Invalid UserID' })
27+
}
28+
2429
logger.info('deserializeUser: ' + user.id)
2530
return done(null, user)
2631
}).catch(function (err) {

0 commit comments

Comments
 (0)