Creating user session only when uploading a screenshot

This makes responses usually cacheable.
This commit is contained in:
Christoph Haas 2016-07-13 14:22:03 +02:00
parent 773548afc3
commit df94be866e
2 changed files with 16 additions and 5 deletions

View file

@ -3,15 +3,15 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :create_user_token
# before_filter :create_user_token
# Do not mention passwords in the log file
# filter_parameter_logging :password
# Assign the visitor a unique hash so that we can track their uploads
# and show them even before moderation.
def create_user_token
session[:token] ||= SecureRandom.hex
session[:ip] ||= request.remote_ip
end
# def create_user_token
# session[:token] ||= SecureRandom.hex
# session[:ip] ||= request.remote_ip
# end
end