mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
test '_userId' instead of session.userId
This commit is contained in:
parent
29770fbc0e
commit
b7dfc21bac
3 changed files with 4 additions and 4 deletions
|
|
@ -69,10 +69,10 @@ mongo_store = new MongoStore {url: process.env.NODE_DB_URI}, ->
|
|||
cookie: { maxAge: TWO_WEEKS } # defaults to 2 weeks? aka, can delete this line?
|
||||
store: mongo_store
|
||||
)
|
||||
# Show splash page for newcomers
|
||||
.use(middleware.splash)
|
||||
# Adds req.getModel method
|
||||
.use(store.modelMiddleware())
|
||||
# Show splash page for newcomers
|
||||
.use(middleware.splash)
|
||||
.use(priv.middleware)
|
||||
.use(middleware.view)
|
||||
.use(auth.middleware(strategies, options))
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ module.exports.splash = (req, res, next) ->
|
|||
# This was an API call, not a page load
|
||||
return next() if req.is('json')
|
||||
|
||||
if !req.session.userId? and !req.query?.play?
|
||||
unless req.query?.play? or req.getModel().get('_userId')
|
||||
res.redirect('/splash.html')
|
||||
else
|
||||
next()
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ module.exports.routes = (expressApp) ->
|
|||
return res.send(500, err.response.error.message)
|
||||
else
|
||||
model = req.getModel()
|
||||
userId = model.session.userId
|
||||
userId = model.get('_userId') or model.session.userId
|
||||
req._isServer = true
|
||||
model.fetch "users.#{userId}", (err, user) ->
|
||||
model.ref '_user', "users.#{userId}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue