Sha256: 7301236cab821e9f373ee4351a470d14fe65885ea5d93906675ba1ec1330a622

Contents?: true

Size: 365 Bytes

Versions: 2

Compression:

Stored size: 365 Bytes

Contents

module Sprangular::Csrf
  extend ActiveSupport::Concern

  included do
    protect_from_forgery

    after_filter :set_csrf_cookie
  end

protected

  def set_csrf_cookie
    cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?
  end

  def verified_request?
    super || form_authenticity_token == request.headers['X-XSRF-TOKEN']
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sprangular-0.1.0 app/controllers/concerns/sprangular/csrf.rb
sprangular-0.0.1 app/controllers/concerns/sprangular/csrf.rb