function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Stephen NStephen N 

Custom Community Login Page - Stuck in loop

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? Thanks in advance for your assistance.
Best Answer chosen by Stephen N
Stephen NStephen N
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}">