Project

General

Profile

Defect #20648 » last_connection_fix.diff

patch (Update "Last connection" value every time) - Go MAEDA, 2015-09-26 09:08

View differences:

app/controllers/application_controller.rb (working copy)
# Check the settings cache for each request
Setting.check_cache
# Find the current user
User.current = find_current_user
logger.info(" Current user: " + (User.current.logged? ? "#{User.current.login} (id=#{User.current.id})" : "anonymous")) if logger
User.current = find_current_user.tap do |user|
user.update_column(:last_login_on, Time.now) if user
logger.info(" Current user: " + (user ? "#{user.login} (id=#{user.id})" : "anonymous")) if logger
end
end
# Returns the current user or nil if no user is logged in
app/models/user.rb (working copy)
end
end
end
user.update_column(:last_login_on, Time.now) if user && !user.new_record? && user.active?
user
rescue => text
raise text
......
# Returns the user who matches the given autologin +key+ or nil
def self.try_to_autologin(key)
user = Token.find_active_user('autologin', key, Setting.autologin.to_i)
if user
user.update_column(:last_login_on, Time.now)
user
end
end
def self.name_formatter(formatter = nil)
......
end
end
end
hash.each do |role, projects|
projects.uniq!
end
(2-2/2)