mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-01 23:40:25 +00:00
Update model.session.userId for next requests
This commit is contained in:
parent
f1666f2d39
commit
5bed0351af
2 changed files with 6 additions and 4 deletions
|
|
@ -88,6 +88,7 @@ get('/:userId?', function(page, model, _arg) {
|
|||
debuggingUsers = parseInt(userId) < 40;
|
||||
if ((userId != null) && (users.get(userId) || debuggingUsers)) {
|
||||
model.set('_userId', userId);
|
||||
model.session.userId = userId;
|
||||
}
|
||||
userId = model.get('_userId');
|
||||
if (!model.get("users." + userId)) {
|
||||
|
|
|
|||
|
|
@ -48,14 +48,15 @@ debug = (obj, message) ->
|
|||
console.log obj, "[debug] #{message}"
|
||||
|
||||
get '/:userId?', (page, model, {userId}) ->
|
||||
|
||||
|
||||
model.subscribe "users", (err, users) ->
|
||||
|
||||
# Previously saved session (eg, http://localhost/{guid}) (temporary solution until authentication built)
|
||||
# Previously saved session (eg, http://localhost/{guid}) (temporary solution until authentication built)
|
||||
debuggingUsers = (parseInt(userId) < 40) #these are users created before guid was in use, need to convert them to guid and get rid of this
|
||||
if userId? and (users.get(userId) or debuggingUsers)
|
||||
model.set '_userId', userId
|
||||
|
||||
model.set '_userId', userId # set for this request
|
||||
model.session.userId = userId # and for next requests
|
||||
|
||||
# Current browser session
|
||||
# The session middleware will assign a _userId automatically
|
||||
# Render page if a userId is already stored in session data
|
||||
|
|
|
|||
Loading…
Reference in a new issue