Trying to handle a case where a user did not have their user account created.

This commit is contained in:
Scott Erickson 2014-03-04 12:21:02 -08:00
parent 3680d628e7
commit 9726840d8a
2 changed files with 6 additions and 1 deletions
app/lib
server/routes

View file

@ -43,7 +43,12 @@ init = ->
module.exports.me = window.me = new User(storedUser)
me.url = -> '/auth/whoami'
me.fetch()
retry = -> me.fetch() # blindly try again
error = -> setTimeout(retry, 1000) # blindly try again
me.on 'error', error, @
me.on 'sync', ->
me.off 'error', error, @ if firstTime
me.url = -> "/db/user/#{me.id}"
trackFirstArrival() if firstTime
if me and not me.get('testGroupNumber')?

View file

@ -11,7 +11,7 @@ module.exports.setup = (app) ->
parts = module.split('/')
module = parts[0]
return getSchema(req, res, module) if parts[1] is 'schema'
return errors.unauthorized(res, 'Must have an identity to do anything with the db.') unless req.user
return errors.unauthorized(res, 'Must have an identity to do anything with the db. Do you have cookies enabled?') unless req.user
try
moduleName = module.replace '.', '_'