better routes delegation in /:uid?
This commit is contained in:
@@ -15,9 +15,11 @@ _ = require 'lodash'
|
||||
|
||||
# ========== ROUTES ==========
|
||||
|
||||
get '/:uidParam?', (page, model, {uidParam}, next) ->
|
||||
#FIXME figure out a better way to do this
|
||||
return next() if (uidParam in ['privacy','terms','auth'])
|
||||
get '/:uid?', (page, model, {uid}, next) ->
|
||||
# delegate to other routes. FIXME how to define express routes first?
|
||||
if uid && !(require('guid').isGuid(uid))
|
||||
return next()
|
||||
|
||||
# Force SSL
|
||||
req = page._res.req
|
||||
if req.headers['x-forwarded-proto']!='https' and process.env.NODE_ENV=='production'
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports.newUserAndPurl = ->
|
||||
## -------- (2) PURL --------
|
||||
# eg, http://localhost/{guid}), legacy - will be removed eventually
|
||||
# tests if UUID was used (bookmarked private url), and restores that session
|
||||
acceptableUid = require('guid').isGuid(uidParam) or (uidParam == '3')
|
||||
acceptableUid = require('guid').isGuid(uidParam)
|
||||
if acceptableUid && sess.userId!=uidParam && !(sess.habitRpgAuth && sess.habitRpgAuth.facebook)
|
||||
# TODO check if in database - issue with accessControl which is on current uid?
|
||||
sess.userId = uidParam
|
||||
|
||||
Reference in New Issue
Block a user