Cruft removed. @remote_ip populated globally
This commit is contained in:
parent
46f76c5220
commit
1c2bfb87d3
1 changed files with 7 additions and 13 deletions
|
|
@ -6,17 +6,9 @@ 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 :get_current_users_screenshots, :moderate_packages
|
before_action :moderate_packages, :get_ip
|
||||||
# TODO: Deprecation. What is the replacement for Rails.env.development? ?
|
|
||||||
|
|
||||||
# Query for packages that were uploaded by the current user.
|
private
|
||||||
# If the user is anonymous then find the uploads by the cookie token.
|
|
||||||
# If the user is logged in then find the uploads by matching the user id.
|
|
||||||
def get_current_users_screenshots
|
|
||||||
if user_signed_in?
|
|
||||||
@current_users_screenshots = current_user.screenshots
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# If the current user is an administrator then show a second bar below
|
# If the current user is an administrator then show a second bar below
|
||||||
# the navigation bar that contains a paginator of packages that contain
|
# the navigation bar that contains a paginator of packages that contain
|
||||||
|
|
@ -27,16 +19,18 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
# Define where the user is redirected to after a successful login.
|
# Define where the user is redirected to after a successful login.
|
||||||
def after_sign_in_path_for(resource)
|
def after_sign_in_path_for(resource)
|
||||||
my_profile_path
|
my_profile_path
|
||||||
#my_welcome_path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Overwriting the sign_out redirect path method
|
# Overwriting the sign_out redirect path method
|
||||||
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_addr
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue