Hello @brady!
You can accomplish this with a Post User Registration Hook and customizing the Password Change email template.
- In the email template section of your dashboard, disable the “Welcome Email” template and the “Email Verification” template by turning off the “Status” toggle. Make sure that “Change Password” is enabled.
- Go to Hooks and scroll down to “Post User Registration” and click “Create new hook”
- Use the following code to send a password reset email whenever a user is manually created for your tenant:
module.exports = function (user, context, cb) {
var auth0 = require('auth0@2.32.0');
var authClient = new auth0.AuthenticationClient({
domain: 'example-connections.us.auth0.com',
clientId: 'YOUR_APP_CLIENT_ID',
clientSecret: 'YOUR_APP_CLIENT_SECRET',
});
var userAndConnection = {
email: user.email,
connection: 'Username-Password-Authentication',
connection_id: context.connection.id,
};
authClient.requestChangePasswordEmail(userAndConnection, function(err){
cb(null, user, context);
});
};
Now when a user is created using the Management API an email will be sent inviting them to change their password.
You will then need to update the email template to make it look more like a welcome email than a change password email. Here are docs on customizing email templates: Customize Email Templates
Related topic: Authenticate and prompt user password change with a single email