diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5d87056..04af206 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,17 +6,9 @@ class ApplicationController < ActionController::Base # Do not mention passwords in the log file # filter_parameter_logging :password - before_action :get_current_users_screenshots, :moderate_packages - # TODO: Deprecation. What is the replacement for Rails.env.development? ? + before_action :moderate_packages, :get_ip - # Query for packages that were uploaded by the current user. - # 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 + private # If the current user is an administrator then show a second bar below # the navigation bar that contains a paginator of packages that contain @@ -27,16 +19,18 @@ class ApplicationController < ActionController::Base end end - private - # Define where the user is redirected to after a successful login. def after_sign_in_path_for(resource) my_profile_path - #my_welcome_path end # Overwriting the sign_out redirect path method def after_sign_out_path_for(resource_or_scope) root_path 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