This commit is contained in:
r888888888
2013-06-10 16:33:26 -07:00
parent 2f2c892670
commit af25507480
7 changed files with 19 additions and 26 deletions

View File

@@ -25,6 +25,7 @@ class SessionLoader
update_last_logged_in_at
set_time_zone
store_favorite_tags_in_cookies
set_statement_timeout
end
@@ -81,6 +82,12 @@ private
cookies[:password_hash] && cookies.signed[:user_name] && User.authenticate_cookie_hash(cookies.signed[:user_name], cookies[:password_hash])
end
def store_favorite_tags_in_cookies
if cookies[:favorite_tags].blank? && CurrentUser.user.favorite_tags.present?
cookies[:favorite_tags] = Tag.categories_for(CurrentUser.user.favorite_tags.scan(/\S+/)).to_a.flatten.join(" ")
end
end
def update_last_logged_in_at
return if CurrentUser.is_anonymous?
return if CurrentUser.last_logged_in_at && CurrentUser.last_logged_in_at > 1.week.ago