mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Redirect to login path also if user is disabled
+ update spec as well
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