Customize the email notification for password change
Users sometimes forget their password, or just feel compelled to change it. To add them, use the Sitefinity CMS functionality that lets users change their password. You can use it to customize the email template that is sent as notification to users who click the Forgot your password? link.
PREREQUISITES:
- Have the Sitefinity email settings configured. For more information, see Administration: Configure email settings.
- Ensure the notification profile configured for the password reset functionality is setup properly. For more information,see Administration: Configure the password recovery link.
Enable email notification with link for changing the password
You must enable the password reset functionality of the Sitefinity CMS, so that when a user requests their password, a new password is generated and is sent to them. Then, you link the Login widget to the Change password widget, so that the users can change their password without the need to reset it first. To do this:
- In the Sitefinity CMS backend, click Administration» Settings » Advanced.
- Click Security» Membership providers » Default» Parameters.
- Click enablePasswordReset.
In the Value field, entertrue. Save your changes. - Click requiresQuestionAndAnswer.
In the Value field, enterfalse. Save your changes. - Recycle your application pool for the changes to take effect.
- Click enablePasswordReset.
- Go to Pages and create a page.
- Drag and drop the Loginwidget and save your changes.
- Click the Editbutton of the Loginwidget and perform the following:
- In the ChangePasswordPageUrl input field, enter the URL of the page where the Change password widget is located.
- In ShowLostPaswordLink, enter
true - Click Save.
- Publish the page.
As a result, when a user attempts login to your website, the *Forgot your password?*link appears. After clicking the link, the user enters the email address they used when registering. The system sends an email containing a link to the page where the Change password widget is located.
Customize the email template body
You can further customize the email template by changing the text in the email body.
By default, the body of the email has the following HTML content:
Dear <%\s*UserDisplayName\s*%>, we received a request for password change for username <%\s*UserName\s*%> at <%\s*SiteName\s*%>.
<br />
<a href="<%\s*ConfirmationUrl\s*%>" target="_blank">Go to this page</a> to set your new password. The link will be active for one hour.
<br />
<br />
Regards,<br />
The <%\s*SiteName\s*%> team
To change the email body:
- Navigate to Administration» Labels and Messages
- Click theLostPasswordEmailBodylabel and edit it.
- Save your changes*.*
EXAMPLE: Following is an example of customized mail body:
HTMLDear <%\s*UserDisplayName\s*%>, <br /> We received a request for password change for username <%\s*UserName\s*%> at <%\s*SiteName\s*%>. <br /> <a href="<%\s*ConfirmationUrl\s*%>" target="_blank">Go to this page</a> to set your new password. The link will be active for one hour. <br /> <br /> Best regards, <br /> The Sitefinity CMS team <br /> <img src="http://www.ssw.com.au/ssw/Consulting/Images/sitefinity-logo.jpg" alt="Sitefinity CMS logo" />