diff --git a/CHANGELOG.md b/CHANGELOG.md index f62376a..464803b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- Blocked content for anonymous users + ## [1.1.0] - 2020-08-13 ### Added diff --git a/docs/README.md b/docs/README.md index a38c8e5..ceb6772 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,7 +8,13 @@ -The Auth Challenge app is an essential B2B feature responsible for checking iif a user is allowed to access the store's content. It helps define which components should be displayed for users that are allowed and users that are not. +The Auth Challenge app is an essential B2B feature responsible for checking if a user is allowed to access the store's content. It helps define which components should be displayed for users that are allowed and users that are not. + +## Example Use Case + +Add a condition to a TP that applies to your user. As an anonymous user, you should not see the real content. When you log in, and if and only if the condition you added above matches your profile, you should see the real content. + +Now remove the condition from the TP that applies to your user. Now as an anonymous user, you should not see the real content. When you login, you should see the real content. :information_source: This check is made according to the Condition Rule specified in the Trade Policy configuration, one of the steps needed to [**configure a B2B environment in VTEX IO**](https://vtex.io/docs/recipes/store/configuring-a-b2b-environment). diff --git a/react/BlockChallenge.tsx b/react/BlockChallenge.tsx index 30a35a5..5a9f8f2 100644 --- a/react/BlockChallenge.tsx +++ b/react/BlockChallenge.tsx @@ -29,7 +29,7 @@ const isProfileAllowed = (sessionResponse: SessionResponse | undefined) => { const isLoggedIn = (sessionResponse as Session).namespaces?.profile?.email - if (hasAccessToTradePolicy) { + if (isLoggedIn && hasAccessToTradePolicy) { return 'authorized' }