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

Authenticated Users to Portal Homepage

Hello - fairly new at Portal so hopefully this is an easy answer but I can't seem to figure it out. I have my Site connected to a Customer Portal for authenticated login but I cannot figure out how to get the login page to redirect to the homepage of the Customer Portal which is not a VisualForce page - it's just plan old portal. Is there a way to easily do this? Am I just missing something? 

Best Answer chosen by Admin (Salesforce Developers) 

Awesome - thanks so much! 

All Answers


you need to update the login apex class home/home.jsp as a startURL


Thanks for the reply - would you mind showing me exactly where to update this within the class? 


Here is the class as it exists - could you highlight or show me exactly where to change it? 




 * 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, 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'; 


take a look at this earlier post.


Awesome - thanks so much! 

This was selected as the best answer

I got it all to work - fantastic. 1 more question - is there a way to force a user to change their password upon logging in? It seems to work when a user asks to reset their own password but when they get the first username and password it doesn't make them change their login. 


if you with the temporary password email flow (do not expose password field on the registration flow), then users will be forced to change their password at their first login.


if you go with select your password flow then they will not be asked to change their password.


I am going with just provisioning portal users via without any self-registration. Someone will be clicking the provision portal user link on the Contact for every user - is there a way to force them to reset their password that way or is it just a training issue? 


the "enable for portal" button on the contact page should send the user a temporary password which then they would need to change their password upon first login. 


AFter I login from the Unauthorized page, it does not redirect to the site Home Page...

It remains on the same page. But the Login History shows this user as logged in.


Need help with this...



take a look at this post. You need to pass the starturl for the target page.


Tried that too. But still does'nt work.


Any idea?


Dear Forum Members,


I am having the same problems as the others. I dont get redirected to the Customer Portal home page after logging into the SiteLogin page. I tried editing the siteLoginController class with Bulent's code. Previously I had just copied the LoginURL for the Customer Portal as the startURL for the Sites login class. That did not work either.

When I try to login using an authenticated user I am brought back to the login page. Although when I click logout it redirects me to the proper logoutURL specified in the Customer portal.

Logically speaking I should be redirected to the LoginURL mentioned on the Customer portal but that would mean that I would have to enter the login details once again when I am on that page (if it eventually does redirect me there). I would ideally like to go directly to the Home tab of the Customer portal. How do I find out the URL for the Home tab of my customer portal so that I can enter that as the startURL.

Another thing was the profile used by the Sites is the Guest profile. How do I change that so that it uses the profile I have created for my Customer Portal users?




Ballal Joglekar