Skip to content

Commit

Permalink
Only accept strings for the logout_link_path configuration value
Browse files Browse the repository at this point in the history
As of now we don't need to also allow procs or symbols as the logout
path is generally not dynamic.
  • Loading branch information
elia committed Aug 2, 2023
1 parent 50bcd28 commit 226ea39
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion admin/app/controllers/solidus_admin/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def current_solidus_admin_user
end

def solidus_admin_logout_path
send SolidusAdmin::Config.logout_link_path
SolidusAdmin::Config.logout_link_path
end

def solidus_admin_logout_method
Expand Down
2 changes: 1 addition & 1 deletion admin/lib/solidus_admin/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def main_nav
preference :current_user_method, :string, default: :spree_current_user

# The path used to logout the user in the admin interface.
preference :logout_link_path, :string, default: :admin_logout_path
preference :logout_link_path, :string, default: '/admin/logout'

# The HTTP method used to logout the user in the admin interface.
preference :logout_link_method, :string, default: :delete
Expand Down
4 changes: 0 additions & 4 deletions admin/lib/solidus_admin/preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ def authenticate_solidus_backend_user!
# noop
end

def admin_logout_path
"/logout"
end

def current_component
@current_component ||= begin
# Lookbook sets the @preview instance variable with a PreviewEntity instance, while ViewComponent uses the preview class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
require "spec_helper"

RSpec.describe SolidusAdmin::Sidebar::Component, type: :component do
before do
allow(vc_test_controller).to receive(:spree_current_user).and_return(build(:user))
without_partial_double_verification do
allow(vc_test_controller.spree).to receive(:admin_logout_path).and_return('/logout')
end
end
before { allow(vc_test_controller).to receive(:spree_current_user).and_return(build(:user)) }

it "renders the overview preview" do
render_preview(:overview)
Expand Down

0 comments on commit 226ea39

Please sign in to comment.