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