mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-21 00:05:15 +02:00
Ensure that each request has a corresponding user in the database.
This commit is contained in:
@@ -92,7 +92,7 @@ module.exports = function(options) {
|
||||
app.get('/api/v1/user', function(req, res) {
|
||||
res.json({
|
||||
success: true
|
||||
, user: req.session.jwt
|
||||
, user: req.user
|
||||
})
|
||||
})
|
||||
|
||||
@@ -147,8 +147,13 @@ module.exports = function(options) {
|
||||
handshake.session = handshake.signedCookies[options.ssid]
|
||||
return dbapi.loadUser(handshake.session.jwt.email)
|
||||
.then(function(user) {
|
||||
handshake.user = user
|
||||
accept(null, true)
|
||||
if (user) {
|
||||
handshake.user = user
|
||||
accept(null, true)
|
||||
}
|
||||
else {
|
||||
accept(null, false)
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user