Forgot Password Email Template
On this page
FusionAuth sends this email when a user starts the forgot password workflow, on the hosted login pages or through the Forgot Password API. The default template is also known as the Change Password template. Assign the template in Forgot password on the Tenants -> Your Tenant -> Identities tab. To override the template for one Application, set the template on the Applications -> Your Application -> Identities tab.
Default Template#
FusionAuth ships the following default template:
[#setting url_escaping_charset="UTF-8"]
To change your password click on the following link.
<p>
[#-- The optional 'state' map provided on the Forgot Password API call is exposed in the template as 'state'.
If we have an application context, append the client_id to ensure the correct application theme when applicable.
--]
[#assign url = "${baseUrl}/password/change/${changePasswordId}?client_id=${(application.oauthConfiguration.clientId)!''}&tenantId=${user.tenantId}" /]
[#list state!{} as key, value][#if key != "tenantId" && key != "client_id" && value??][#assign url = url + "&" + key?url + "=" + value?url/][/#if][/#list]
<a href="${url?html}">${url?html}</a>
</p>
- FusionAuth Admin[#setting url_escaping_charset="UTF-8"]
To change your password click on the following link.
[#-- The optional 'state' map provided on the Forgot Password API call is exposed in the template as 'state'.
If we have an application context, append the client_id to ensure the correct application theme when applicable.
--]
[#assign url = "${baseUrl}/password/change/${changePasswordId}?client_id=${(application.oauthConfiguration.clientId)!''}&tenantId=${user.tenantId}" /]
[#list state!{} as key, value][#if key != "tenantId" && key != "client_id" && value??][#assign url = url + "&" + key?url + "=" + value?url/][/#if][/#list]
${url}
- FusionAuth AdminReplacement Variables#
applicationThe Application object. For field definitions, see the Application API.
The variable is present only when the request that sends the email identifies an Application. Check for the variable before you use it:
[#if application??]
${application.name}
[/#if]
baseUrlThe base URL for links in the email. FusionAuth uses the Application baseURL, then the Tenant baseURL, then http://localhost:9011.
changePasswordIdThe change password Id for the Change a User's Password API.
stateThe state from the forgot password request. The variable is present only when the request includes state.
tenantThe Tenant object. For field definitions, see the Tenant API.
userThe User object for the recipient. For field definitions, see the User API.
Related
Learn about the email templates FusionAuth sends and the replacement variables each template receives.
API documentation for the FusionAuth Create an Email Template API.
Learn about the APIs for creating, retrieving, updating and deleting email templates as well as sending emails to users.
API documentation for the FusionAuth Preview an Email Template API.