1

I am customizing the CommunitiesLogin page using VF but am having troubles directing to this customized page. When navigating to my_community_url/login I see the standard, out of the box login page. When navigating to my_community_url/CommunitiesLogin my browser gets stuck in a loop.

I have my Community set up as Active Site Home Page = CC_Home, Inactive Site Home Page = CC_Home and the login page set as the Visualforce Page CommunitiesLogin.

Here is my CommunitiesLoginController:

global with sharing class CommunitiesLoginController {

global CommunitiesLoginController () {}

// Code we will invoke on page load.
global PageReference forwardToAuthPage() {
    String startUrl = System.currentPageReference().getParameters().get('startURL');
    String displayType = System.currentPageReference().getParameters().get('display');
    return Network.forwardToAuthPage(startUrl, displayType);
}

//code to invoke custom login page
global PageReference forwardToCustomAuthPage() {
    String startUrl = System.currentPageReference().getParameters().get('startURL');
    return new PageReference(Site.getPathPrefix() + '/SiteLogin?startURL=' +
    EncodingUtil.urlEncode(startURL, 'UTF-8'));
}}

Here is my CommunitiesLandingController:

public with sharing class CommunitiesLandingController {

// Code we will invoke on page load.
public PageReference forwardToStartPage() {
    return Network.communitiesLanding();
}

//code to invoke custom login page
public PageReference forwardToCustomAuthPage() {
    String startUrl = System.currentPageReference().getParameters().get('startURL');
    return new PageReference(Site.getPathPrefix() + '/SiteLogin?startURL=' +
    EncodingUtil.urlEncode(startURL, 'UTF-8'));
}

public PageReference forwardTocustomStartPage() {
    return new PageReference('/apex/CC_Home');
}

public CommunitiesLandingController() {}
}

Here is the first line from the CommunitiesLogin page:

<apex:page id="loginPage" controller="CommunitiesLoginController" 
action="{!forwardToCustomAuthPage}" title="{!$Label.site.site_login}">

Here is the first line from the CommunitiesLanding page:

<apex:page id="communitiesLandingPage" controller="CommunitiesLandingController" 
action="{!forwardTocustomStartPage}" title="{!$Label.site.site_login}">

Any guesses as to what is causing this loop?

1

This issue was resolved by removing the action call in the CommunitiesLogin page.

Updated code:

<apex:page id="loginPage" controller="CommunitiesLoginController" title="{!$Label.site.site_login}">
| improve this answer | |

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.