Sha256: 9094ce66740f137c9ac739f82037fc3dff41b3569fc9942d95f7709f5e5a852b
Contents?: true
Size: 507 Bytes
Versions: 4
Compression:
Stored size: 507 Bytes
Contents
module VerifyCsrfToken extend ActiveSupport::Concern included do before_action :set_csrf_cookie rescue_from ActionController::InvalidAuthenticityToken do redirect_back fallback_location: "/", notice: "The page expired, please try again." end end def request_authenticity_tokens super << request.headers["HTTP_X_XSRF_TOKEN"] end private def set_csrf_cookie cookies["XSRF-TOKEN"] = { value: form_authenticity_token, same_site: "Strict" } end end
Version data entries
4 entries across 4 versions & 1 rubygems