Logging fixed. Debugging finished.
This commit is contained in:
parent
bc7541a2c9
commit
b6dee6b93c
4 changed files with 4 additions and 16 deletions
|
|
@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base
|
||||||
# Do not mention passwords in the log file
|
# Do not mention passwords in the log file
|
||||||
# filter_parameter_logging :password
|
# filter_parameter_logging :password
|
||||||
|
|
||||||
before_action :moderate_packages, :get_ip
|
before_action :moderate_packages
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
@ -28,9 +28,4 @@ class ApplicationController < ActionController::Base
|
||||||
def after_sign_out_path_for(resource_or_scope)
|
def after_sign_out_path_for(resource_or_scope)
|
||||||
root_path
|
root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get the visitor's IP address to make it accessible to the Log model
|
|
||||||
def get_ip
|
|
||||||
@remote_ip = request.remote_ip
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ class Users::MySessionsController < Devise::SessionsController
|
||||||
|
|
||||||
# Hook after successful login
|
# Hook after successful login
|
||||||
def after_login
|
def after_login
|
||||||
Log.log "User #{current_user.email} logged in.", @remote_ip
|
Log.log "User #{current_user.email} logged in.", request.remote_ip
|
||||||
old_screenshots = session[:uploaded_screenshots]
|
old_screenshots = session[:uploaded_screenshots]
|
||||||
if old_screenshots.to_a.length > 0
|
if old_screenshots.to_a.length > 0
|
||||||
old_screenshots.each do |id|
|
old_screenshots.each do |id|
|
||||||
|
|
@ -14,7 +14,7 @@ class Users::MySessionsController < Devise::SessionsController
|
||||||
end
|
end
|
||||||
# The message is probably confusing. Just add the screenshots.
|
# The message is probably confusing. Just add the screenshots.
|
||||||
# flash[:info] = "#{old_screenshots.to_a.length} uploads have been added to your account"
|
# flash[:info] = "#{old_screenshots.to_a.length} uploads have been added to your account"
|
||||||
Log.log "Anonymously uploaded screenshots #{old_screenshots} added to #{current_user.email}.", @remote_ip
|
Log.log "Anonymously uploaded screenshots #{old_screenshots} added to #{current_user.email}.", request.remote_ip
|
||||||
session[:uploaded_screenshots] = nil
|
session[:uploaded_screenshots] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ class Log < ApplicationRecord
|
||||||
order('id DESC')
|
order('id DESC')
|
||||||
}
|
}
|
||||||
|
|
||||||
def self.log(message, ip_address, section='frontend', level='info')
|
def self.log(message, ip_address='0.0.0.0', section='frontend', level='info')
|
||||||
log = Log.new
|
log = Log.new
|
||||||
|
|
||||||
ip_address = request.remote_ip if defined? request
|
ip_address = request.remote_ip if defined? request
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,3 @@
|
||||||
/ ' | Cookie is #{session[:token]}
|
/ ' | Cookie is #{session[:token]}
|
||||||
|
|
||||||
= render 'cookies_eu/consent_banner', link: '/about#cookies'
|
= render 'cookies_eu/consent_banner', link: '/about#cookies'
|
||||||
|
|
||||||
p
|
|
||||||
tt =request.remote_ip
|
|
||||||
p
|
|
||||||
tt =@remote_ip
|
|
||||||
p
|
|
||||||
tt =ENV.inspect
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue