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
GoodiesdGoodiesd 

Custom Login Page for Customer Portal

Hi guys, I am struggling here to get a custom visualforce page that is the Active Site Home Page for Saites that I want to be a branded logon controller to get my customers into customer portal. I am stuck with the ugly default login page that is generated with customer portal. Have had 2 differnt consutalts hack at it with no luck.

I have a visualforcepage linked to sites that references a login controller like this:

<c:SiteLogin id="siteLogin"/>

Then the site login controller looks like this:

/**
* An apex page controller that exposes the site login functionality
*/
global class SiteLoginController {
    global String username {get; set;}
    global String password {get; set;}

    global PageReference login() {
        String startUrl = System.currentPageReference().getParameters().get('startURL');
        return site.login(username, password, '/home/home.jsp');
    }
   
    global SiteLoginController () {}
   
    global static testMethod void testSiteLoginController () {
        // Instantiate a new controller with all parameters in the page
        SiteLoginController controller = new SiteLoginController ();
        controller.username = 'test@salesforce.com';
        controller.password = '123456';
               
        System.assertEquals(controller.login(),null);                          
    }   
}


GoodiesdGoodiesd
One last update before moving to Zendesk in hopes someone has an answer.. We tweaked the class trying to get the user to the Customer Portal home page which is home/home.jsp. It looks like the authentication works but after a second it reverts me to the standard Salesforce.com login page.

Let me know if anyone has any ideas here how to simply log someone in to Customer Portal from a public facing visualforce site. We are at a loss on my team...

//global with sharing class SiteLoginController {
global class SiteLoginController {

//set username/ password variables via page
global String username {get; set;}
global String password {get; set;}

global PageReference login() {

//static org-id and portal id
String sfdcBaseURL = URL.getSalesforceBaseUrl().toExternalForm();
String strOrgID = '00DS0000003xxx';
String strPortalID = '06070000000xxxx';
String strURL = 'https://na5.salesforce.com';
String startUrl = strURL + '/home/home.jsp?orgId=' + strOrgID + '&amp;portalId=' + strPortalID;
//start url of the page


startUrl += '&amp;un=' + username;
startUrl += '&amp;pw='+ password;

//set reference and attempt login
PageReference portalPage = new PageReference(startUrl);
portalPage.setRedirect(true);
PageReference p = Site.login(username, password, startUrl);

//if p==null, no login
if (p == null) {
return Site.login(username, password, null);
} else {
return portalPage;
}
}