Created
April 21, 2017 11:14
-
-
Save Irostovsky/44f3f20d949e2b03f9d8099eb64e930a to your computer and use it in GitHub Desktop.
AuthenticityTokenCatcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AuthenticityTokenCatcher | |
extend ActiveSupport::Concern | |
included do | |
rescue_from ActionController::InvalidAuthenticityToken do |exception| | |
if request.referrer | |
flash[:error] = I18n.t :authenticit_token_error | |
redirect_to request.referrer | |
else | |
raise exception | |
end | |
end | |
end | |
end | |
#module Users | |
# class SessionsController < Devise::SessionsController | |
# include AuthenticityTokenCatcher | |
# ......... | |
# end | |
#end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment