mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
fix crash
This commit is contained in:
@@ -175,15 +175,17 @@ function authorize(socket, callback) {
|
||||
cookieParser(handshake, {}, next);
|
||||
},
|
||||
function(next) {
|
||||
db.sessionStore.get(handshake.signedCookies['express.sid'], next);
|
||||
},
|
||||
function(sessionData, next) {
|
||||
if (sessionData && sessionData.passport && sessionData.passport.user) {
|
||||
socket.uid = parseInt(sessionData.passport.user, 10);
|
||||
} else {
|
||||
socket.uid = 0;
|
||||
}
|
||||
next();
|
||||
db.sessionStore.get(handshake.signedCookies['express.sid'], function(err, sessionData) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
if (sessionData && sessionData.passport && sessionData.passport.user) {
|
||||
socket.uid = parseInt(sessionData.passport.user, 10);
|
||||
} else {
|
||||
socket.uid = 0;
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
], callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user