Universal Login Password Reset unable to get user's language

I’m trying to make our password reset screen bilingual based on the user’s settings. We have the “language” parameter set in the user’s meta data (we also tried a dozen other names for it) but in the password reset screen, the “lang” variable never picks this up. It always returns “en-US,en;q=0.5”. I set up the proper languages in the auth0 tenant options, so that shouldn’t be a problem. No documents mention anything about how to do it, they just say “lang” will contain the user’s language, which there doesn’t appear to be any way to actually set using the management API, dashboard, etc. How can I do this?

I assume you are using the Classic ULP and not the New ULP (referring to Auth Dashboard > Universal Login).

In the password reset page template, you don’t have direct access to the user object. It’s not available as an object there, and thus also no info about the user_metadata.

So, the way to go is to add the user’s language information already in the email template: add the language of the user to the URL of the confirmation link in the mail, like this:

  1. In the Auth0 Dashboard, go to Email Templates > Select “Change Password”, look for {{ url }} in the template and replace it with this:
    <a href="{{ url }}{{user.user_metadata.lang}}">

  2. In the password reset page, you’ll then have this info available via document.location.hash (in the Javascript section)


Just finished implementing and testing, works like a charm! Thank you!

1 Like

Glad we were able to help!

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