Guest User

Untitled

a guest
May 26th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1.  
  2. # this monkey patch for Rails 2.3.5 means each action has its own token, i'm not
  3. # sure if this actually makes things more secure or worse.
  4. ActionController::RequestForgeryProtection.class_eval do
  5. def form_authenticity_token_with_action(*args)
  6. session_var_name = "_csrf_token_#{controller_name}_#{action_name}"
  7. session[session_var_name.to_sym] ||= ActiveSupport::SecureRandom.base64(32)
  8. end
  9. alias_method_chain :form_authenticity_token, :action
  10. end
Add Comment
Please, Sign In to add comment