Hi all,
We customized the email template for Change Password for one tenant in the UK and with the support of hooks for Post User Creation using AuthenticationClient
and then calling the method requestChangePasswordEmail()
it is possible to receive emails using the default email provider and the email will have the customized email template
Now, after exporting the configs via Auth0 Deploy CLI to then import on another UK tenant the same process works exactly in the same fashion.
When we export the configs to a tenant in Australia or Europe the same code sends a completely different email with subject: “Reset your password” and some copy that includes “You have submitted a password change request!” with the reset
url like
https:///lo/reset?ticket=xxxxxxxxxxxxx#
My question(s) is
- why does this only work on UK?
- And most importantly, how can i control this email template? Is is a legacy email template like change_password or password_reset?
For reference find the hook here
(the auth0 npm package version is 2.44.1)
module.exports = function (user, context, cb) {
const auth0 = require('auth0');
const authClient = new auth0.AuthenticationClient({
domain: '##AUTH0_DOMAIN##',
clientId: '##AUTH0_SPA_CLIENT_ID##'
});
const userAndConnection = {
email: user.email,
connection: 'Username-Password-Authentication'
};
authClient.requestChangePasswordEmail(userAndConnection, () => {
var response = {};
response.user = user;
response.user.user_metadata.invitedToApp = true;
cb(null, user, response);
});
}