Repository navigation
Show guest account screens in a minimal layout when the store is not open to guests - #1084
Merged
Merged
Conversation
added 4 commits
November 22, 2026 16:23
added 3 commits
November 22, 2026 17:23
The value no longer rides on nine view models through a result filter. The guest account views use _GuestAccount, which asks IStoreAccessService and renders as _SingleColumn or _LayoutAuth; Login reads the same service to hide links. Nothing defaults to Open when a filter is missed or a model goes out as JSON, the two-factor step renders without a model again, and a new guest screen needs only the layout name.
…open TwoFactorAuthorization had neither [PublicStore(true)] nor [ClosedStore(true)], so a customer with two-factor sign-in on was sent back to Login (registered-only store) or to Store closed after entering the password. SetLanguage was blocked on a closed store, so the language selector on the sign-in screens did nothing.
They carry scripts such as analytics and consent, not catalog content; _LayoutPopup keeps them too. Without them sign-in and Store closed pages sent no analytics on stores that use the minimal layout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: no issue, the problem is described below
Type: feature
Issue
If a store is open to registered customers only (Guests lose the "Public store. Allow navigation" permission), or the store is closed, guests are sent to
/login. That page renders inside the full storefront layout, so a guest still sees the store's content: the search box lists the categories, the footer lists CMS pages and links to blog, news, knowledge base and new products, and the newsletter box and promo block are rendered. View components do not go through thePublicStorefilter, and only the menu checks the permission itself.To reproduce: remove "Public store. Allow navigation" from Guests, then open the store in a private window. You are redirected to
/login, which shows the category drop-down in the search box and the footer links.Solution
The guest-reachable screens keep their URLs, actions and views. When the visitor may not browse the store, they render in a new minimal layout instead of
_SingleColumn, similar to the admin login page: theme styles, logo, language selector, cookie consent and the form. The header, menu, search box, footer and content widget zones are not rendered.IStoreAccessService(Grand.Web.Common.Security.Authorization) returnsStoreAccessfor the customer of the request:Closed: the store is closed and the customer has noAccessClosedStore.RegisteredOnly: the customer has noPublicStoreAllowNavigation.Open: everyone else.Views/Shared/_GuestAccount.cshtmlasks the service and renders as_SingleColumn(Open) or_LayoutAuth(otherwise). Login, register, register result, password recovery and confirm, account activation, two-factor and the OIDC link and failure views setLayout = "_GuestAccount";StoreClosedalways uses_LayoutAuth. View models and controllers are unchanged, so a new guest screen only needs the layout name._LayoutAuthkeeps thehead_html_tag,body_start_html_tag_afterandbody_end_html_tag_beforezones, which carry scripts such as analytics and consent.TwoFactorAuthorization(GET and POST) gets[PublicStore(true)]and[ClosedStore(true)]likeLogin. Before, a customer with two-factor sign-in on was sent back to/loginor to Store closed after the password step.SetLanguagegets[ClosedStore(true)], so the language selector works on the sign-in screens of a closed store.Known limits, left for separate PRs:
_SingleColumn.Layoutline until it switches to_GuestAccount. Modern and Nordic do not override them.Breaking changes
None intended. The two-factor step and the language switch are now reachable by guests of a closed or registered-only store, as the login page already was. Behavior for a store open to guests is unchanged.
Testing
dotnet test src/Tests/Grand.Web.Common.Testsanddotnet test src/Tests/Grand.Web.Testspass. New tests:StoreAccessServiceTests(4) andStoreAccessAttributeTests(two-factor actions andSetLanguagecarry the exemptions)./. It redirects to/login, which shows the logo, the language selector and the form. The page source has nosearch-box, no<footer>and no guest order link./registerand/passwordrecoverylook the same./login./loginshows the full layout as before./redirects to/storeclosed(minimal layout)./loginshows the form without the register, forgot-password and guest-order links,/registerredirects to/storeclosed, and/changelanguage/{code}?returnUrl=/loginreturns to/login.