TransWikia.com

Change retURL for ChangePassword page

Salesforce Asked by Eric Strom on February 16, 2021

When users click to reset their password and go through the process through the link that gets sent in an email, there’s a variable retURL that seems to be the url to redirect to once the password is successfully reset. I have been unable to find anywhere in the admin or anywhere in the template/controllers/etc. where this retURL value is specified. The page that’s being used for resetting the password is just the default reset password page. Any ideas of where this value can be found and replaced would be greatly appreciated.

One Answer

The best workaround I found for this was to use the standard ChangePassword template page, style it up obviously, and then change the controller (ChangePasswordController) default changePassword method to redirect to the intended destination:

public PageReference changePassword() {
    // This is the original code
    // return Site.changePassword(newPassword, verifyNewPassword, oldpassword);    
    // Changed it to the following:
    // Change the password, then explicitly login the user with the new password and redirect
    Site.changePassword(newPassword, verifyNewPassword, oldpassword);    
    return Site.Login(Userinfo.getUsername(), newPassword, '/newRedirectPath');
}     

Then you could just set the default change password page to be a Visualforce page (ChangePassword), add the page to the Site Enabled VF Pages, and you're good to go.

Answered by Boris Bachovski on February 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP