Sha256: 39a8428abc371031d85ec78dea012ceae09180e1c8478228e4386f899b49b311
Contents?: true
Size: 507 Bytes
Versions: 13
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
13 entries across 13 versions & 1 rubygems