FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login
    1. Home
    2. Tags
    3. templates
    Log in to post
    • All categories
    • F

      Solved FreeMarker error: postMethod variable null in registration verify template

      Frequently Asked Questions (FAQ)
      • freemarker templates themes registration verification • • FASupportBot
      2
      0
      Votes
      2
      Posts
      155
      Views

      F

      The postMethod variable can be null or missing in certain scenarios (such as when a verification link is clicked multiple times), causing the FreeMarker template to fail.

      To fix this, you need to provide a safe fallback for the postMethod variable. Update line 16 in your registration/verify.ftl template from:

      [#if verificationId?? && postMethod]

      To:

      [#if verificationId?? && (postMethod!false)]

      The !false syntax provides a default value of false when postMethod is null or missing, preventing the FreeMarker exception.

      Steps to apply the fix:

      Navigate to Customizations → Themes in the FusionAuth admin UI Edit your theme Locate the registration/verify.ftl template Update the conditional check as shown above Save the theme

      This pattern can be applied to other templates where variables might be null or missing in certain execution paths.

      Why this happens:

      According to the FusionAuth documentation, the postMethod variable is not a standard template-specific variable for the /registration/verify template. It is typically available on other verification templates like /email/verify (where it defaults to true). The registration verify template is rendered when a user clicks the URL from the verification email and the verificationId has expired or is invalid. In these scenarios, postMethod may not be set in the template context, which causes the FreeMarker error when attempting to evaluate it as a boolean.

      Related Documentation Theme Template Variables - Verify Registration - Documents the variables available in the registration verify template Theme Template Variables - Email Verification - Shows that postMethod is documented for email verification but not registration verification Theme Template Variables - Complete reference for all template variables across different templates
    • J

      Email Template URL Calculation

      Q&A
      • email templates url • • jim.sadden
      4
      0
      Votes
      4
      Posts
      6.0k
      Views

      ?

      A couple of options:

      You could optionally configure a different template for each tenant so you could hard code the correct URL in each template.

      You could also add the correct URL to the tenant.data and then pull it out in the template during render so you could use the same template across tenants.

      If the state parameter is working well for you for other APIs, you could open a feature request in GH to add this to the API in question.

    • danD

      Can you use the same template for the forgot password and send password emails?

      Q&A
      • email templates • • dan
      2
      0
      Votes
      2
      Posts
      2.9k
      Views

      danD

      Since both APIs are technically the same, is there a way to use the email template defined for the Setup Password with the Forgot Password API?

      Yes. Navigate to 'Tenants -> your tenant -> Email' and you can set 'Setup password' and 'Forgot password' to be the same template.

      There may be template variable differences, please consult the documentation and ensure you are checking for existence before you rely on them:

      https://fusionauth.io/docs/v1/tech/email-templates/email-templates/#setup-password

      https://fusionauth.io/docs/v1/tech/email-templates/email-templates/#change-password

    • danD

      How can I get the client_id in my email template?

      Q&A
      • email freemarker templates • • dan
      2
      0
      Votes
      2
      Posts
      2.7k
      Views

      danD

      I figured it out…. I just had to put state.client_id in parens so it resolved them together.

      [#assign clientId = (state.client_id?string)!"dafb6ef6-a2a8-4d34-9d69-59bfed3e31aa" /]
    • danD

      Solved When using kickstart are there any email templates included?

      Q&A
      • kickstart email templates • • dan
      2
      0
      Votes
      2
      Posts
      2.8k
      Views

      danD

      Kickstart does not load any templates by default. You will need to create any template you’d like in your initial configuration.

      Outside of kickstart we do build some default templates. In Kickstart, no templates.

      Here's the email templates we ship with if you want to add them to your Kickstart: https://fusionauth.io/docs/v1/tech/email-templates/email-templates#templates-replacement-variables

    • danD

      Can you access timeout settings (for password resets, for example) in the email templates?

      Q&A
      • templates passwordless password reset email • • dan
      3
      0
      Votes
      3
      Posts
      3.2k
      Views

      danD

      See also https://github.com/FusionAuth/fusionauth-issues/issues/612

    • danD

      Does template localization include the freemarker date and time built-in function?

      Q&A
      • templates datetime freemarker • • dan
      2
      0
      Votes
      2
      Posts
      2.9k
      Views

      danD

      Yes. Set the locale in the template and this will display the correct values, for example the month name.

      More on freemarker here: https://freemarker.apache.org/docs/

      Here's how to set the locale in a template: https://freemarker.apache.org/docs/ref_directive_setting.html