You need to sign in to do that
Don't have an account?
Goodiesd
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);
}
}
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);
}
}
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 + '&portalId=' + strPortalID;
//start url of the page
startUrl += '&un=' + username;
startUrl += '&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;
}
}