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
RameshkannanRameshkannan 

Force.com Sites - Login Page - not redirecting.

 

Hi all,

Please check the code and reply me .

The problem is after user login to the site . it should be redirected to " hpage"(vf page which will act as a homepage)

In this case , i couldnot be able to redirect to that page.

genius pls help me out .

Code below :

global class LoginController {
    global String username {get; set;}
    global String password {get; set;}

    global PageReference login() {
        String startUrl = System.currentPageReference().getParameters().get('hpeppdemo-developer-edition.ap1.force.com/SiteLogin?StartURL=/Welcomepage/hpage');
        return Site.login(username, password,'hpeppdemo-developer-edition.ap1.force.com/SiteLogin?StartURL=/Welcomepage/hpage');
    }
    
        global LoginController () {}
    
    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);                           
    }    
}

Whether the format of the start url is correct ?



Regards
Ramesh
RyanGuestRyanGuest

Change this line:

 

return Site.login(username, password,'hpeppdemo-developer-edition.ap1.force.com/SiteLogi n?StartURL=/Welcomepage/hpage');

 

to say this:

 

return Site.login(username, password,'/hpage');
RameshkannanRameshkannan

Can you please tell me , who are all can use the sites. Only the user with authenticated website licence can access the sites ?

 

 I mean to say only the customer portal users or authenticated website users  can access and not a  normal salesforce.com user ?

 

please post the login page code for the reference.

 

Please provide me with the details.

 

 

Thanks

Ramesh

 

RyanGuestRyanGuest

Normal Salesforce.com users can never use Force.com Sites.

 

Portal users: Customer Portal (customer portal, high volume portal user, authenticated website user) or Partner Portal (partner) can access sites.

 

If you want these users to be able to use your site, you'll need to associate the portal with the site under the "Login Settings" section of the Site setup page. You'll notice on this page that only a single portal can be associated with a site at one time. So if you create a customer portal and associate it with a site - only this portal will be able to login to your site.

RameshkannanRameshkannan

Thanks ryan.

 

 

Can you please give me the code for save button ie. {!save } and login page.

 

After clicking the save  button it should not show the default page( ie.saved record page). it needs to be navigated to another visual force page which i create.

 

Example : if i click submit button. it needs to be navigated to another page ,in which it should show " thanks for registering".

 

the same is applicable to the login page also . after clicking the button it needs to be navigated to the home page.

 

please help me .

 

Thanks

Ramesh

SwapnilSwapnil

Hey Ryan that means we cannot pass more than 1 parameter to the StartUrl. I have a requirement wherein I have to pass more than 1 parameter. But it seems that the part after the 1st parameter is lost and never considered. Is there a workaround..