1

I'm working on reworking our entire Community Site (Napili).

Due to a complex model, we want to create 2 or 3 communities. Is there a way, to have a single login page (Visualforce Page in which we will split our users by filters). And, by their profiles or some filter, redirect our user to the community he can access.

I know that, for each community we can add a custom login page.

In a wonderful world, I would like to have a single login page with a Lightning Component, calling Apex methods & co, to redirect my user on the right community.

Schema :

----------------------------- LOGIN PAGE -------------------------

                 /                 |             \
             Community A      Community B      Community C
  • why not use page variations? how many pages from the community need to be different from your base template, are the different communities based on user profiles, does the branding have to be different for each? – glls Oct 19 '17 at 13:31
  • it's not about branding. But more about fonctionnality : - Show some lightning component for userA and some other for userB. <br> - On click on the link, go to the PageA for userA and PageB for userB... – FabienHuot Oct 19 '17 at 13:38
  • 1
    assuming user a and b have different profiles, i'm still curious to know why page variations are not an option for your use case? – glls Oct 19 '17 at 13:46
  • You're right. I'll investigate on that way. Thanks @glls – FabienHuot Oct 19 '17 at 15:34
1

If I understand correctly, Based on what profile is logging in, you would like to offer different functionalities in different community pages.

Page variations offer this flexibility, depending on the amount of page variations you will need, rather than maintaining 3 different communities and a custom login page, you will have to maintain all the page variations that target different audiences.

You will have to determine this based on your use case and take the following into consideration:

Assigning specific audience criteria to a page variation lets you target a particular set of members. Criteria include:

  • Profile

  • Location

  • Record type

  • Hi, You're right. I've done some research about page variation, and the best answer for us, it to create a new profile and do some page variation. Thanks @glls for your help ! :) – FabienHuot Oct 23 '17 at 13:31
  • glad i was able to help – glls Oct 23 '17 at 13:32
1

Add the login page to each of your communities then build some controller logic to direct them to the correct landing page for the particular community the user belongs to. After the login is successful of course.

Example using profile name

public PageReference loginRedirect() {
    PageReference pageRef;

    if (profileName.equals('Community 1 profile')) {//feel free to put them in a set
        pageRef = Page.Community1LandingPage;
    else if (...) ...

    return pageRef;
}

Example using Site Name:

public PageReference loginRedirect() {
    String siteName = Site.getName();
    PageReference pageRef;

    if (siteName.equals('Community1') {
        pageRef = Page.Community1LandingPage;
    } else ...

    return pageRef;
}

I use this sort of logic for an org where we have several communities and one login page for all of them. You can also customize your VF if you have slight differences you want to display on the login page using {!$Site.Name} in your markup.

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.