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

Sites Forgot Password Page is not working

I have a site that I we have created that the forgot password link is not working.  When you put in the username and click submit, it just sits there.  The ForgotPassword Confirm page does not display nor does the email get sent.  This is the standard Forgot Password pages and controller that was built when the site was created so they are standard pages. 


Any help is greatly appreciated.  This is an urgent project we are trying to roll and it's driving me insane.


Code for the page is here. 


<apex:page id="Registration" showHeader="false" controller="ForgotPasswordController" title="{!$}">

<apex:stylesheet value="{!URLFOR($Resource.CP_Site_Resources, 'main.css')}"/>

    <apex:composition template="CPSiteTemplate">

        <apex:define name="body">

            <div id="mainouter">
                <div id="maininner" align="center">
                  <apex:form id="theForm" forceSSL="true">
                    <apex:panelGrid columns="2" style="margin-top:1em;">
                      <apex:outputLabel value="{!$}" for="username"/>
                      <apex:inputText required="true" id="username" value="{!username}"/>
                      <apex:commandButton id="submit" value="{!$}" action="{!forgotPassword}"/>
                   <!-- Closing maininner Div here -->
            <!-- closing mainouter Div here -->    






 * An apex page controller that exposes the site forgot password functionality
public class ForgotPasswordController {
    public String username {get; set;}  
    public ForgotPasswordController() {}
    public PageReference forgotPassword() {
        boolean success = Site.forgotPassword(username);
        PageReference pr = Page.ForgotPasswordConfirm;
        if (success) {              
            return pr;
        return null;
     public static testMethod void testForgotPasswordController() {
        // Instantiate a new controller with all parameters in the page
        ForgotPasswordController controller = new ForgotPasswordController();
        controller.username = '';        




This is 4 years later, but I ran into an issue like this but not exactly the same. I needed to add the forgot password page to the site's page list.
Joseph BundaJoseph Bunda
This problem appears to persist several years later. I'm running into the same issues, where Site.forgotPassword is not reseting the user's password, yet reporting success. No email is sent regardless. I've removed all merge fields from the template and double-checked deliverability settings, and also confirmed that the user is recieving emails from Salesforce.
John DickinsonJohn Dickinson
Same issue here, method Site.forgotPassword(username) returns true, however no email sent.
Reminds me of this...
"What did you see Melliott?"
Tushar Arora 26Tushar Arora 26
I am also running into the same issue. Has anyone found the solution ? What may be the reason, I am not receiving password reset emails after calling Site.forgotPassword().  ? Site.forgotPassword() is returning true.
Tushar Arora 26Tushar Arora 26
Now it is working fine.
Just understood what I was doing wrong.
1) When I was opening the Forgot password VF page for previewing in Salesforce org then it was not sending the email to reset the password.
2) When I opened the same VF page in the Site / Community / Customer Portal and then reset the password then it sent me a reset email.

May be Salesforce does not send the reset email when you are previewing the VF page in Salesforce but when you will open the VF page in Site / Community / Customer Portal and then reset the password then it will send you a reset email if everything is fine.