Create unique token for each user in the cookie session
This commit is contained in:
parent
81850f367c
commit
e1bef18152
1 changed files with 9 additions and 0 deletions
|
|
@ -2,4 +2,13 @@ class ApplicationController < ActionController::Base
|
|||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
before_filter :create_user_token
|
||||
|
||||
# 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
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue