Custom Password Change Page For Community Users


Salesforce communities come with an inbuilt password change functionality. However, we can override this functionality to implement a custom password change page for users to provide them with a more personalized outlook. For this, we can either customize the default password template in Visualforce or create new password change pages to use in place of the default page.


In order to achieve this, we first need to disable the default functionality of ‘Send Welcome Email’ of the communities and send our custom email instead, when a community user is created. The email can contains the link to the community which redirects the user to the custom Password Change Visualforce Page.

In the custom page, resetPassword() method of System class is used to generate a new password for a specified user. This method takes in two parameters: userId, which is the id of the user whose password is to be reset and a Boolean type parameter sendUserEmail, which determines whether the user is to be notified that his password has been reset or not.

The return value for this method is of type System.ResetPasswordResult. It represents the result of password reset. getPassword() method of ResetPasswordResult Class is used to return the password generated by resetPassword() call.

Syntax: ResetPasswordResult rpr =System.resetPassword(Id userId, Boolean sendUserEmail);
String password = rpr.getPassword();

Here’s the step by step guide for doing the same:

  1. Go to Setup. In the quick find box, type Communities and select All Communities.
  2. Click on Manage button for the community for which this functionality is to be implemented.
  3. Click Administration→Emails and deselect the ‘Send Welcome Email’ checkbox.
  4. Custom Password Change Image

  5. Add the custom page to Visualforce Site Pages.
  6. Go to ‘Login & Registration’ and scroll to Password section. Select ‘Visualforce page’ in the Change password drop down list. Click on the lookup icon and select the desired visualforce page and save.

  7. Custom Password Change Image

    Voila! You’re done!

For any query on Custom Password Change, contact