I am using Custom Change Password page (built on VF) for Force.com site. The same page we are using for 3 different layouts - mobile, web and app view. For the app, I have put a logic that redirects to new change password page that's specific only to the mobile app. After setting the password, I want a user to login directly to the system using site.login(username, password, startURL), but startURL is null on this page as we are losing the context of this value. I was able to generate startURL on Sign In as below-

String startURL = System.currentPageReference().getParameters().get('startURL');

But the same doesn't seem to work on a new Change Password page. Any suggestions to counter this issue?

1 Answer 1


I was able to resolve it. I captured the current page context at Custom Change Password page as below -

window.location.href = '{!$Page.ChangePasswordPage}?startUrl={!URLENCODE($CurrentPage.parameters.retURL)}';

Retrieved it at customized change password page as below -

startUrl = System.currentPageReference().getParameters().get('startURL');

And to log in, using below script -

Site.login(username, newPassword, startUrl); 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .