From b8277bbd58432be3d9568e70e510ea414338e5f4 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 30 Sep 2013 03:41:45 +0200 Subject: [PATCH] Improved time of setting session user. --- app/controllers/sessions_controller.rb | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index cfb6fa9db..c509e87a3 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -14,6 +14,10 @@ class SessionsController < ApplicationController return end + # set session user + current_user_set(user) + + # log new session user.activity_stream_log( 'session started', user.id ) # auto population of default collections @@ -42,8 +46,6 @@ class SessionsController < ApplicationController # :user_id => user['id'] # } # ) - else - session[:user_id] = user['id'] end # return new session data @@ -125,12 +127,15 @@ class SessionsController < ApplicationController authorization = Authorization.create_from_hash(auth, current_user) end + # set current session user + current_user_set(authorization.user) + + # log new session + user.activity_stream_log( 'session started', authorization.user.id ) + # remember last login date authorization.user.update_last_login - # Log the authorizing user in. - session[:user_id] = authorization.user.id - # redirect to app redirect_to '/' end @@ -140,7 +145,15 @@ class SessionsController < ApplicationController # Log the authorizing user in. if user - session[:user_id] = user.id + + # set current session user + current_user_set(user) + + # log new session + user.activity_stream_log( 'session started', user.id ) + + # remember last login date + user.update_last_login end # redirect to app