Guest User

Untitled

a guest
Feb 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. def form_authenticity_token
  2. @form_authenticity_token ||= if !session.respond_to?(:session_id)
  3. raise InvalidAuthenticityToken, "Request Forgery Protection requires a valid session. Use #allow_forgery_protection to disable it, or use a valid session."
  4. elsif request_forgery_protection_options[:secret]
  5. authenticity_token_from_session_id
  6. elsif session.respond_to?(:dbman) && session.dbman.respond_to?(:generate_digest)
  7. authenticity_token_from_cookie_session
  8. else
  9. raise InvalidAuthenticityToken, "No :secret given to the #protect_from_forgery call. Set that or use a session store capable of generating its own keys (Cookie Session Store)."
  10. end
  11. end
Add Comment
Please, Sign In to add comment