# Authenticate and prompt user password change with a single email

**URL:** <https://community.auth0.com/t/authenticate-and-prompt-user-password-change-with-a-single-email/57221>\
**Category:** Get Help\
**Tags:** change-password, authentication, login, auth0\
**Created:** [February 2, 2021, 6:30pm UTC](https://community.auth0.com/t/authenticate-and-prompt-user-password-change-with-a-single-email/57221 "2021-02-02T18:30:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lee\_Peters](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lee_peters/32/27339_2.png) [@Lee\_Peters](https://community.auth0.com/u/Lee_Peters)\
**Post date:** [February 2, 2021, 6:30pm UTC](https://community.auth0.com/t/authenticate-and-prompt-user-password-change-with-a-single-email/57221/1 "2021-02-02T18:30:25Z")

</div>

I am seeking to authenticate a new `Username-Password-Authentication` user type AND allow them to immediately change their password with a single e-mail action. Surely I’m missing something since this seems to be a fairly simple and common operation. But can’t seem to figure it out. Has anyone had success doing this?

The desired workflow, ideally via Auth0 dashboard and not API or Rules, would be:

1. a new user is manually added and given a temporary password
2. an authentication email is sent to a given user
3. that authentication email provides that user with a single link which…  
3a) authenticates their email and…  
3b) allows them to change their password

Thanks and let me know if I can provide further clarification.

Update: I see in [@ssingh’s post](https://community.auth0.com/t/clicking-on-change-password-email-link-also-verifies-users-email-without-using-email-verification-link/46410) that prompting a password change will also verify an email. Do the Auth0 folks agree that sending a password change email to new users would be an acceptable workaround?

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [February 3, 2021, 1:44pm UTC](https://community.auth0.com/t/authenticate-and-prompt-user-password-change-with-a-single-email/57221/3 "2021-02-03T13:44:45Z")

</div>

Hi @Lee_Peters,

> [@Lee\_Peters](#):
>
> I see in [@ssingh’s post](https://community.auth0.com/t/clicking-on-change-password-email-link-also-verifies-users-email-without-using-email-verification-link/46410) that prompting a password change will also verify an email. Do the Auth0 folks agree that sending a password change email to new users would be an acceptable workaround?

Yes! That is one of the options listed in our email invitation guide: [Send Email Invitations for Application Signup](https://auth0.com/docs/auth0-email-services/send-email-invitations-for-application-signup)

Let us know if you have additional questions!

---

<div class="post-metadata">

**Author:** ![Lee\_Peters](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lee_peters/32/27339_2.png) [@Lee\_Peters](https://community.auth0.com/u/Lee_Peters)\
**Post date:** [February 3, 2021, 2:33pm UTC](https://community.auth0.com/t/authenticate-and-prompt-user-password-change-with-a-single-email/57221/4 "2021-02-03T14:33:22Z")

</div>

Thanks for the quick reply @stephanie.chamblee! This process looks exactly like what we’re trying to achieve but potentially a more code heavy than what I was hoping for. In what environment should this be done? Within a Rule? Within our API’s back end (hoping to avoid)? All stupid questions, I know, but I’m new to Auth0 and relatively new to coding in general so further clarification would be helpful.

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [February 3, 2021, 7:44pm UTC](https://community.auth0.com/t/authenticate-and-prompt-user-password-change-with-a-single-email/57221/5 "2021-02-03T19:44:20Z")

</div>

Reasonable questions!

If you are manually creating users to a database connection, you can set up a Hook to send the change password request.

1. 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.
2. Go to _Hooks_ and scroll down to “Post User Registration” and click “Create new hook”
3. Use the following code to send a password reset email whenever a user is manually created for your tenant:

```auto
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);
  });
};

```

After you set up the Hook, an email will be sent to users 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](https://auth0.com/docs/auth0-email-services/customize-email-templates)

---

<div class="post-metadata">

**Author:** ![Lee\_Peters](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lee_peters/32/27339_2.png) [@Lee\_Peters](https://community.auth0.com/u/Lee_Peters)\
**Post date:** [February 3, 2021, 9:14pm UTC](https://community.auth0.com/t/authenticate-and-prompt-user-password-change-with-a-single-email/57221/6 "2021-02-03T21:14:24Z")

</div>

Worked perfectly! You’re the best, @stephanie.chamblee - thanks again!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 21, 2021, 9:27am UTC](https://community.auth0.com/t/authenticate-and-prompt-user-password-change-with-a-single-email/57221/8 "2021-02-21T09:27:29Z")

</div>

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