Merge pull request #9351 from vsmay98/9338-redirect-disabled-user-to-homepage

Redirect to homepage with flash error when disabled user trying to access any page
This commit is contained in:
Filipe
2022-08-12 13:52:19 +01:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

View File

@@ -165,8 +165,9 @@ class ApplicationController < ActionController::Base
return unless current_spree_user.disabled
flash[:success] = nil
flash.now[:error] = I18n.t("devise.failure.disabled")
flash[:error] = I18n.t("devise.failure.disabled")
sign_out current_spree_user
redirect_to main_app.root_path
end
end

View File

@@ -16,6 +16,7 @@ module Spree
prepend_before_action :handle_unconfirmed_email
before_action :set_checkout_redirect, only: :create
after_action :ensure_valid_locale_persisted, only: :create
skip_before_action :check_disabled_user
def create
authenticate_spree_user!