Sha256: e8f1ef198bf9c8404ec0b7a1d4a0ccf08f50d5f7f73a4a22f3693ab3be555150

Contents?: true

Size: 536 Bytes

Versions: 9

Compression:

Stored size: 536 Bytes

Contents

module Oxymoron
  module Concern
    extend ActiveSupport::Concern

    included do
      after_action :set_xsrf_token_cookie
    end

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

    def verified_request?
      if respond_to?(:valid_authenticity_token?, true)
        super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])
      else
        super || form_authenticity_token == request.headers['X-XSRF-TOKEN']
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
oxymoron-1.2.8 lib/oxymoron/concern.rb
oxymoron-1.2.7 lib/oxymoron/concern.rb
oxymoron-1.2.6 lib/oxymoron/concern.rb
oxymoron-1.2.5 lib/oxymoron/concern.rb
oxymoron-1.2.4 lib/oxymoron/concern.rb
oxymoron-1.2.3 lib/oxymoron/concern.rb
oxymoron-1.2.2 lib/oxymoron/concern.rb
oxymoron-1.2.1 lib/oxymoron/concern.rb
oxymoron-1.2.0 lib/oxymoron/concern.rb