2

is there any way to show the separate page based on personalisation rule? i need to show one page when the user is authenticated and another page when user is not authenticated.

Personalization is the best way here? any other way to achieve here?

we may use Azure AD authentication with Sitecore jSS.

  • Do the pages have to have the same URL? Or can it be different URLs? – Jason St-Cyr Feb 15 at 13:12
  • for anonymous users , home page and another page for authenticated users. – Hussain Feb 15 at 13:13
  • You can break inheritance of access rights on pages other than homepage and in the site definition set home page as the login page. – Marek Musielak Feb 15 at 14:15
2

I created a module which does what you need and explained how it works in my blog post:

https://www.skillcore.net/sitecore/sitecore-page-rules

General idea is that your page template contains a Rules field where you can set any conditions and actions you want.

Then there is a pipeline processors which runs:

var rules = RuleFactory.GetRules<PageRulesRuleContext>(rulesField);

if (rules == null || rules.Count == 0)
    return;

var ruleContext = new PageRulesRuleContext();
rules.Run(ruleContext);

One of the actions I've created is Redirect to another page action. Just use it together with when user is anonymous condition.

Be aware that I haven't tested it with JSS so you may need to hook into some other pipeline, not the one I used.

0

You can only personalize renderings on a page. In order to show entirely different pages based login state you can use rights i.E. deny read for extranet/Anonymous on the page that sould only be visible for logged in users and vice versa.

  • You can use pipeline to verify user authenticated or not and make decisions. This case similar to secured/protected pages. – Amit Kumar Feb 15 at 15:04
0

If I understand your requirement, you want to redirect the user to right page if the user tries to access the wrong page, based on login.

Let's say page A should be shown to logged in user and page B should be shown if the user is not logged in i.e. anonymous user.

You may develop a rendering which does the redirect work. Like on page A, set up this rendering to redirect to page B if an anonymous user tries to access page A. Also, set up this redirect rendering on page B to redirect logged in user to page A. You may have datasource for the rendering to provide information about where to redirect. Redirect on either page will happen only if rendering is loaded. So, you may manage the loading of the rendering based on personalization. You may use Security condition 'where the current user is anonymous' as shown below. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.