# How to force password change if password doesn't match new password policy

**URL:** <https://community.auth0.com/t/how-to-force-password-change-if-password-doesnt-match-new-password-policy/189009>\
**Category:** Get Help\
**Tags:** reset-password-prompt-classic-experience, login-experience\
**Created:** [July 10, 2025, 8:24am UTC](https://community.auth0.com/t/how-to-force-password-change-if-password-doesnt-match-new-password-policy/189009 "2025-07-10T08:24:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hawk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hawk/32/71335_2.png) [@hawk](https://community.auth0.com/u/hawk)\
**Post date:** [July 10, 2025, 8:24am UTC](https://community.auth0.com/t/how-to-force-password-change-if-password-doesnt-match-new-password-policy/189009/1 "2025-07-10T08:24:28Z")

</div>

We’ve recently changed our password policy to be more secure. Is there a way that we can force current users to reset their password if it doesn’t meet the new policy?

---

<div class="post-metadata">

**Author:** ![teodor.andrei](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/teodor.andrei/32/75320_2.png) [@teodor.andrei](https://community.auth0.com/u/teodor.andrei)\
**Post date:** [July 11, 2025, 10:15am UTC](https://community.auth0.com/t/how-to-force-password-change-if-password-doesnt-match-new-password-policy/189009/3 "2025-07-11T10:15:40Z")

</div>

Hi @hawk, and welcome to the Auth0 Community!

Your use case should be easily achievable with a **Post-login Action** that adds a check for password strength using the `zxcvbn` library. Something like this should work, but let me know if it doesn’t:

```auto
exports.onExecutePostLogin = async (event, api) => {
  if (event.connection.strategy !== 'auth0') {
    return;
  }

  const password = event.request.body.password;
  if (!password) {
    return;
  }

  const zxcvbn = require('zxcvbn');
  const strength = zxcvbn(password);

  const requiredScore = 3; //set to the score you need

  if (strength.score < requiredScore) {
    return api.access.deny(
      'password_reset_required'
    );
  }
};

```

Don’t forget to add `zxcvbn` to the dependencies in the **Dependencies** tab of the **Actions** menu.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/9/292034003d373e3425a9c0bdf47e8c2d431547ad.png)

I hope this helps you!

Sincerely,  
Teodor.

---

<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:** [July 25, 2025, 10:15am UTC](https://community.auth0.com/t/how-to-force-password-change-if-password-doesnt-match-new-password-policy/189009/4 "2025-07-25T10:15:45Z")

</div>

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