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
bpkeatingbpkeating 

Partner Portal Direct User to Alternate page after Site.login

I have a user requirement for a user to accept a terms of service agreement after they log in.

 

Their acceptance will be recorded and then they are to be allowed to access the partner portal.

 

So far I have tried using different forms of site.login starturl and pagereference redirects with out any success. The custome login page always takes me to the associated partner portal for the login associated to the site.

 

return

Site.login(username, password, '\visualforcepagename');

 

I would like to direct the user through the terms of service page on login or redirect them to it when the get into the portal if they have not accepted the terms.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Abhay AroraAbhay Arora

Hi ,

 

You need to create a JS component and add it on the home page components which will redirect user to desired page as needed.

 

1.) Create a custom home page component with "HTML Area" App Setup->Customize->home->homepage compoments

 

2.) add a js there for redirection

 

3.) add that component to the home page and enable it for all.

 

And your problem is solved

All Answers

Abhay AroraAbhay Arora

So basically what you need is a intermediate page where you will check that Value

 

if(value){

  page ref to main home page

}else{

 

page ref to terms and condition page

}

 

And above is to be set on the ACTION of the visualforce page

<apex:page showHeader="true" sidebar="false" Controller="MyCon" action="{!ACTION IN YOUR CONTROLLER}" >

 

Please mark this issue as solved if above is what you need

bpkeatingbpkeating

I will not have a problem once I get the site to redirect.

 

I am having a continuing problem with the Site.login command

 

The original command was Site.login(username, password, '/home/home.jsp');

i changed it to Site.login(username, password, /apex/TermsPage);

 

It started redirecting me to the login screen after authentication instead of the portal home page.

Now I have switched the function back and it still directs me to the Login screen rather than the portal home page.

 

This is a custome login controller it calls

 

heres the method

 

globalPageReference login() {

 

string startURL = '/home/home.jsp';

 

return Site.login(username,password, startURL);

  

 

}

Abhay AroraAbhay Arora

Hi ,

 

You need to create a JS component and add it on the home page components which will redirect user to desired page as needed.

 

1.) Create a custom home page component with "HTML Area" App Setup->Customize->home->homepage compoments

 

2.) add a js there for redirection

 

3.) add that component to the home page and enable it for all.

 

And your problem is solved

This was selected as the best answer
bpkeatingbpkeating

This is working up to a point.

 

I have a js component on the home page and am able to redirect. Since the redirect is conditional I had a webservice that tells me if I need to redirect based on the relevent criteria.

 

The problem I am now encountering is that the ajax javascript controls do not access the service as the authenticated portal user. In researching this it shows that the sforce.connection.SessionId value is not being set.

 

All documentation shows to set it by setting it = {!$API.SessionId} however this value is only available via apex. Since this is being called from the home page there is no way to run apex code.

 

Any Suggestions?

bpkeatingbpkeating

So my final solution was to create a home page custom link that set a variable to the sessionID.

 

I then referenced the value from the variable in the Custom HTML area with Javascript.

 

I then hid the custom link using jquery.

 

 

john sanjohn san

This is great information.  We are trying to to this also.  Would you mind sharing your code?