redirect when userObj not present (that should never be happening, but

it is - diagnosing)
This commit is contained in:
Tyler Renelle 2013-01-19 14:16:59 -05:00
parent a3e75da2ba
commit 3dc9bad6ae

View file

@ -25,10 +25,9 @@ get '/', (page, model, next) ->
#if req.headers['x-forwarded-proto']!='https' and process.env.NODE_ENV=='production' #if req.headers['x-forwarded-proto']!='https' and process.env.NODE_ENV=='production'
# return page.redirect 'https://' + req.headers.host + req.url # return page.redirect 'https://' + req.headers.host + req.url
userPath = "users.#{model.session.userId}" model.subscribe "users.#{model.session.userId}", (err, user) ->
model.subscribe userPath, (err, user) ->
# Set variables which are passed from the controller to the view
userObj = user.get() userObj = user.get()
return page.redirect '/500.html' unless userObj? #this should never happen, but it is. Looking into it
# support legacy Everyauth schema (now using derby-auth, Passport) # support legacy Everyauth schema (now using derby-auth, Passport)
if username = userObj.auth?.local?.username if username = userObj.auth?.local?.username