+ Start a Discussion
srikanth11srikanth11 

very very urgent issue

hi i am working on customer portal and i have written this code for login and password details actually i am new to this plz check my code and some plz help me with some code how to make this work

/**
 * 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');
if (startUrl == null)
   startURL = (Site.getPrefix() != null ? '' : Site.getPrefix()) + '</home/home.jsp>'; 
   
        return Site.login(username, password, startUrl);
        //return page.page;
    }
    /*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);                           
    }  */
      
}

 

IbigfootIbigfoot
Hi,
Should you be rolling your own customer portal logins?
see https://login.salesforce.com/help/doc/en/customer_portal_enabling_features_settings.htm .. does this help your situation?Cheers,
hemantgarghemantgarg

from the above code it looks like you are using force.com sites authnticated via customer portal. your code is fine , just want to add that after login it will redirect you to the start url, so you have to made that page visible nad proper for logging in user.