# Password expiration policy

**URL:** <https://community.auth0.com/t/password-expiration-policy/87419>\
**Category:** Get Help\
**Tags:** security, password, auth0\
**Created:** [July 21, 2022, 8:47pm UTC](https://community.auth0.com/t/password-expiration-policy/87419 "2022-07-21T20:47:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![isaac.gontovnik](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/isaac.gontovnik/32/37811_2.png) [@isaac.gontovnik](https://community.auth0.com/u/isaac.gontovnik)\
**Post date:** [July 21, 2022, 8:47pm UTC](https://community.auth0.com/t/password-expiration-policy/87419/1 "2022-07-21T20:47:53Z")

</div>

It will be great to have a password expiration policy feature at Auth0. Best,

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [July 22, 2022, 12:14am UTC](https://community.auth0.com/t/password-expiration-policy/87419/3 "2022-07-22T00:14:23Z")

</div>

Hello @isaac.gontovnik welcome to the community!

While not available as a setting in the Dashboard per se, you can certainly take advantage of [Rules](https://auth0.com/docs/customize/rules) or (preferably) [Actions](https://auth0.com/docs/customize/actions). For example, there is currently a template available when you go to create a Rule in your Dashboard called “Check last password reset” which you can configure to force a user’s password to be reset after a specific amount of time. The rule looks like this:

```auto
function checkLastPasswordReset(user, context, callback) {
  function daydiff(first, second) {
    return (second - first) / (1000 * 60 * 60 * 24);
  }

  const last_password_change = user.last_password_reset || user.created_at;

  if (daydiff(new Date(last_password_change), new Date()) > 30) {
    return callback(new UnauthorizedError('please change your password'));
  }
  callback(null, user, context);
}

```

Alternatively, you could use a Post Login Action to achieve similar results by utilizing the `last_password_reset` of the `event.user` [object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/event-object).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 6, 2022, 12:14am UTC](https://community.auth0.com/t/password-expiration-policy/87419/4 "2022-08-06T00:14:29Z")

</div>

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