mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
Merge pull request #9341 from jibees/9336-redirect-to-login_path-if-user-is-disabled
Disabled_at logic: redirect to login path if user is disabled
This commit is contained in:
@@ -78,7 +78,7 @@ module Spree
|
||||
|
||||
def load_object
|
||||
@user ||= spree_current_user
|
||||
if @user
|
||||
if @user && !@user.disabled
|
||||
authorize! params[:action].to_sym, @user
|
||||
else
|
||||
redirect_to main_app.login_path
|
||||
|
||||
@@ -111,5 +111,16 @@ describe '
|
||||
expect(page).to have_content I18n.t(:you_have_no_orders_yet)
|
||||
end
|
||||
end
|
||||
|
||||
context "as a disabled user" do
|
||||
before do
|
||||
user.disabled = '1'
|
||||
end
|
||||
|
||||
it "redirects to the login page" do
|
||||
visit "/account"
|
||||
expect(page).to have_current_path("/")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user