mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Block disabled users from logging in
This commit is contained in:
committed by
Jean-Baptiste Bellet
parent
39a6b5d20f
commit
bc9dcc7cbc
@@ -39,6 +39,7 @@ class ApplicationController < ActionController::Base
|
||||
include Spree::Core::ControllerHelpers::Common
|
||||
|
||||
before_action :set_cache_headers # prevent cart emptying via cache when using back button #1213
|
||||
before_action :check_disabled_user, if: :spree_user_signed_in?
|
||||
before_action :set_after_login_url
|
||||
|
||||
include RawParams
|
||||
@@ -159,6 +160,14 @@ class ApplicationController < ActionController::Base
|
||||
response.headers["Pragma"] = "no-cache"
|
||||
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
|
||||
end
|
||||
|
||||
def check_disabled_user
|
||||
return unless current_spree_user.disabled?
|
||||
|
||||
flash[:success] = nil
|
||||
flash.now[:error] = I18n.t("devise.failure.disabled")
|
||||
sign_out current_spree_user
|
||||
end
|
||||
end
|
||||
|
||||
require 'spree/i18n/initializer'
|
||||
|
||||
Reference in New Issue
Block a user