Inconsistency between translating reset_email vs passwordless "magic" link

Hi, we have noticed while we are trying to translate the two different emails reset_email and passowordless connection that they behave differently when it comes to what kind of available attributes we can use with the liquid syntax.

Like for instance, when customizing the passwordless email template, we have access to a tag called request_language (e.g en,nb;q=0.9,no;q=0.8,en-US;q=0.7,en-GB;q=0.6,nn;q=0.5 ) which is equal to the Accept-Language header user’s is requesting when clicking the reset password link. But when we are triggering the password reset flow we won’t get access to the same attribute when translating. This inconsistency makes it harder to create a default experience where we can use the user’s prioritized languages in the browser.

We are familiar that we can store the locale in user_metadata and use it when translating, but that also requires us to sync the locale to auth0 before we send an email asking them to the reset the password, or log in using google or linkedin.

The most ideal situation for us is that we could have used both approaches

  1. User ask for reset password. User does not exist in auth0 and we don’t have the locale → use the browser locale
  2. When the user logs in. Use a action on the login flow to update the locale in user_metadata
  3. The second reset of password will then use the locale in user_metadata

Same goes for the passwordless flow where we are not able to set the user_metadata during the login flow, but as long as we do have access to both user_metadata and the request_language we are able to fallback to sane default that makes sense for the user

Is this a bug or a feature that we don’t have access to request_language in reset_emails? Do we have the same issue with all of the other email templates as well?

For the curious we extract the locale from request_language using the following liquid snippet in the passwordless email

{%- assign languages = request_language | split: "," -%}
{%- assign selectedLocale = 'nb' -%}

{%- for lang in languages -%}
    {%- assign locale = lang | slice: 0,2 -%}
    {%- if locale == 'nb' or locale == 'no' or locale == 'nn' -%}
        {%- assign selectedLocale = "nb" -%}
        {%- break -%}
    {%- elsif locale == 'sv' -%}
        {%- assign selectedLocale = 'sv' -%}
        {%- break -%}
    {%- endif -%}
{%- endfor -%}

{{ selectedLocale }}

Hi @vegafolq,

Welcome to Auth0 Community!

I see that you have already gotten assistance through the Support Center for this issue, but I wanted to reply here for the community as well.

In this doc you will find the available common variables for all email templates:
https://auth0.com/docs/customize/email/email-templates#common-variables

As you already noted, ‘request_language’ is not included in the list. In the description for passwordless email templates, we state that ‘request_language’ is one of the variables defined specifically for the Passwordless Email template:
https://auth0.com/docs/customize/email/email-templates/email-template-descriptions#passwordless-emails

If you would like our Product team to include that variable in all other templates, you could create a feature request explaining your use case and the reason why you think this is valuable. We strongly encourage you to submit and vote for product feedback or feature requests through our Feedback category.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.