Improved time of setting session user.

This commit is contained in:
Martin Edenhofer 2013-09-30 03:41:45 +02:00
parent 88e827e686
commit b8277bbd58

View file

@ -14,6 +14,10 @@ class SessionsController < ApplicationController
return return
end end
# set session user
current_user_set(user)
# log new session
user.activity_stream_log( 'session started', user.id ) user.activity_stream_log( 'session started', user.id )
# auto population of default collections # auto population of default collections
@ -42,8 +46,6 @@ class SessionsController < ApplicationController
# :user_id => user['id'] # :user_id => user['id']
# } # }
# ) # )
else
session[:user_id] = user['id']
end end
# return new session data # return new session data
@ -125,12 +127,15 @@ class SessionsController < ApplicationController
authorization = Authorization.create_from_hash(auth, current_user) authorization = Authorization.create_from_hash(auth, current_user)
end 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 # remember last login date
authorization.user.update_last_login authorization.user.update_last_login
# Log the authorizing user in.
session[:user_id] = authorization.user.id
# redirect to app # redirect to app
redirect_to '/' redirect_to '/'
end end
@ -140,7 +145,15 @@ class SessionsController < ApplicationController
# Log the authorizing user in. # Log the authorizing user in.
if user 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 end
# redirect to app # redirect to app