Creating user session only when uploading a screenshot
This makes responses usually cacheable.
This commit is contained in:
parent
773548afc3
commit
df94be866e
2 changed files with 16 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue