> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Post Change Password Trigger

> Learn about the Post Change Password flow and the post-change-password Action trigger, which runs after a Database connection user resets or changes their password. This trigger can be used to notify another system that the user’s password has changed.

The Post Change Password trigger runs after a user resets or changes their password. You can use this trigger to email the user after a password change or to notify another system that the user’s password has changed, so that other sessions not managed by Auth0 can be revoked.

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/auth0/docs/images/fr-ca/cdy7uua7fh8z/3i65TvmTpHkyDTqKvXAkMi/3adb8f0bd195cec4dd0a82cb87b270b9/post-change-password-flow.png" alt="Diagram showing the Actions Post Change Password Flow." />
</Frame>

Actions in this flow are non-blocking (asynchronous), which means the Auth0 pipeline will continue to run without waiting for the Action to finish its execution. Thus, the Action's outcome does not affect the Auth0 transaction.

## Triggers

### Post Change Password

The `post-change-password` trigger runs after a database connection user resets or changes their password.

Multiple Actions can be bound to this trigger, and the Actions will run in order. However, these Actions will be run asynchronously and will not block the password reset process.

### Reference

* [Event object](/docs/fr-ca/customize/actions/explore-triggers/password-reset-triggers/post-change-password-trigger/post-change-password-event-object): Provides contextual information about the user and the connection on which the password was changed.
* [API object](/docs/fr-ca/customize/actions/explore-triggers/password-reset-triggers/post-change-password-trigger/post-change-password-api-object): Provides methods for changing the behavior of the flow.

## Common use cases

### Invalidate the user’s session in another system

A post-change-password Action can be used to invalidate the user's session in another system:

```javascript lines theme={null}
const axios = require("axios");

/**
 * @param {Event} event - Details about user whose password was changed.
 */
exports.onExecutePostChangePassword = async (event) => {
  axios.post("https://my-api.exampleco.com/revoke-session", { params: { email: event.user.email }});
};
```

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  Pour utiliser une bibliothèque `npm` comme `axios`, vous devez ajouter la bibliothèque à l’Action en tant que dépendance. Pour en savoir plus, lisez la section « Ajouter une dépendance » dans [Rédigez votre première action](/docs/fr-ca/customize/actions/write-your-first-action).
</Callout>

### Send an email after the user changes their password

```javascript lines theme={null}
const axios = require("axios");

exports.onExecutePostChangePassword = async (event) => {
  try {
    // https://sendgrid.api-docs.io/v3.0/mail-send
    axios.post('https://api.sendgrid.com/v3/mail/send',
      {
        personalizations: [{
          to: [{ email: event.user.email }]
        }],
        from: { email: 'admin@exampleco.com' },
        subject: 'Your password was changed',
        content: [{
          type: 'text/plain',
          value: 'The password for your ' + event.connection.name + ' account ' + event.user.email + ' was recently changed.'
        }]
      },
      {
        headers: {
          'Authorization': 'Bearer ' + event.secrets.SENDGRID_API_KEY
        },
      }
    );
  } catch (err) {
    console.log(`Error sending email to ${event.user.email}:`, err.message)
  }
};
```
