Merge pull request #1767 from okriuchykhin/ok_SCI_2841

Improve handling of CSRF token errors [SCI-2841]
This commit is contained in:
Alex Kriuchykhin 2019-05-15 13:48:19 +02:00 committed by GitHub
commit d12723f7c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -10,6 +10,10 @@ class ApplicationController < ActionController::Base
around_action :set_time_zone, if: :current_user
layout 'main'
rescue_from ActionController::InvalidAuthenticityToken do
redirect_to root_path
end
def respond_422(message = t('client_api.permission_error'))
respond_to do |format|
format.json do

View file

@ -1,6 +1,11 @@
class Users::SessionsController < Devise::SessionsController
# before_filter :configure_sign_in_params, only: [:create]
after_action :after_sign_in, only: :create
rescue_from ActionController::InvalidAuthenticityToken do
redirect_to new_user_session_path
end
# GET /resource/sign_in
def new
# If user was redirected here from OAuth's authorize/new page (Doorkeeper