Sha256: d8a86e9d99a1f03c77ee2e4e5ec77ff671f64822f7991931f45d843ddc0d01b7

Contents?: true

Size: 562 Bytes

Versions: 5

Compression:

Stored size: 562 Bytes

Contents

# frozen_string_literal: true
module SocialNetworking
  module Concerns
    # Rescues exception when authenticity token has expired
    module InvalidAuthToken
      extend ActiveSupport::Concern

      included do
        rescue_from ActionController::InvalidAuthenticityToken,
                    with: :invalid_auth_token_redirect
      end

      private

      def invalid_auth_token_redirect
        redirect_to "/",
                    alert: "Your authenticity token expired. "\
                           "Please try again."
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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