Sha256: 60d5e7dc4627bc9b2f626cb257b8e158cb70d559ddcf8ec7da988284d8ef1ad9

Contents?: true

Size: 719 Bytes

Versions: 5

Compression:

Stored size: 719 Bytes

Contents

# frozen_string_literal: true
module SocialNetworking
  # Top level engine controller
  # Inherits from host's ApplicationController.
  class ApplicationController < ::ApplicationController
    include Concerns::InvalidAuthToken

    CSRF_COOKIE_NAME = "XSRF-TOKEN"
    CSRF_HEADER_NAME = "X-XSRF-TOKEN"

    before_action :authenticate_participant!
    after_action :set_csrf_cookie_for_ng

    layout "tool"

    protected

    def verified_request?
      super ||
        valid_authenticity_token?(session, request.headers[CSRF_HEADER_NAME])
    end

    private

    def set_csrf_cookie_for_ng
      return unless protect_against_forgery?
      cookies[CSRF_COOKIE_NAME] = form_authenticity_token
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social_networking-0.13.3 app/controllers/social_networking/application_controller.rb
social_networking-0.13.2 app/controllers/social_networking/application_controller.rb
social_networking-0.13.1 app/controllers/social_networking/application_controller.rb
social_networking-0.13.0 app/controllers/social_networking/application_controller.rb
social_networking-0.12.0 app/controllers/social_networking/application_controller.rb