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

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);
    /*global SiteLoginController () {}
    global static testMethod void testSiteLoginController () {
        // Instantiate a new controller with all parameters in the page
        SiteLoginController controller = new SiteLoginController ();
        controller.username = '';
        controller.password = '123456'; 
    }  */


Should you be rolling your own customer portal logins?
see .. does this help your situation?Cheers,

from the above code it looks like you are using 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.