Skip to content

Commit

Permalink
Fix PWA for organizations with forced sign-in
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi committed Oct 17, 2023
1 parent 98ad00b commit 9277b11
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/controllers/concerns/decidim/force_authentication_override.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

module Decidim
# Shared behaviour for force_users_to_authenticate_before_access_organization
module ForceAuthenticationOverride
extend ActiveSupport::Concern

included do
private

def unauthorized_paths
%w(/locale /manifest.webmanifest) + Decidim::StaticPage.where(
organization: current_organization,
allow_public_access: true
).pluck(Arel.sql("CONCAT('/pages/', slug)"))
end
end
end
end
5 changes: 5 additions & 0 deletions config/initializers/decidim_overrides.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

Rails.application.config.to_prepare do
Decidim::ForceAuthentication.prepend(Decidim::ForceAuthenticationOverride)
end
6 changes: 6 additions & 0 deletions spec/lib/overrides_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"/app/views/layouts/decidim/_conferences_nav.html.erb" => "65d135dc663b18be367a7c514ae7c0a6",
"/app/views/decidim/conferences/conferences/show.html.erb" => "94e3fb8ee4e092678ce0f229c87e1bc0"
}
},
{
package: "decidim-core",
files: {
"/app/controllers/concerns/decidim/force_authentication.rb" => "372d0656d449f9655b4fc378cb0b3c2e"
}
}
]

Expand Down

0 comments on commit 9277b11

Please sign in to comment.