module ActionController::RequestForgeryProtection

Protected Instance Methods

form_authenticity_token() click to toggle source

Sets the token value for the current session.

# File lib/subdomainbox/secure_csrf_token.rb, line 11
def form_authenticity_token
  raise 'CSRF token secret must be defined' if CSRF_TOKEN_SECRET.nil? || CSRF_TOKEN_SECRET.empty?
  if request.session_options[:id].nil? || request.session_options[:id].empty?
    original_form_authenticity_token
  else
    Digest::SHA1.hexdigest("#{CSRF_TOKEN_SECRET}#{request.session_options[:id]}#{request.subdomain}")
  end
end
original_form_authenticity_token()