mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-23 22:52:14 +00:00
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>
This commit is contained in:
parent
a40dcdd222
commit
eddf8a3a33
1 changed files with 5 additions and 0 deletions
|
@ -21,6 +21,11 @@ passport.deserializeUser(function (id, done) {
|
||||||
id: id
|
id: id
|
||||||
}
|
}
|
||||||
}).then(function (user) {
|
}).then(function (user) {
|
||||||
|
// Don't die on non-existent user
|
||||||
|
if (user == null) {
|
||||||
|
return done(null, false, { message: 'Invalid UserID' })
|
||||||
|
}
|
||||||
|
|
||||||
logger.info('deserializeUser: ' + user.id)
|
logger.info('deserializeUser: ' + user.id)
|
||||||
return done(null, user)
|
return done(null, user)
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
|
|
Loading…
Reference in a new issue