# Trigger reset password every x days

**URL:** <https://forum.keycloak.org/t/trigger-reset-password-every-x-days/25235>\
**Category:** Getting advice\
**Tags:** authentication\
**Created:** [March 26, 2024, 12:39pm UTC](https://forum.keycloak.org/t/trigger-reset-password-every-x-days/25235 "2024-03-26T12:39:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tania](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tania/32/9460_2.png) [@tania](https://forum.keycloak.org/u/tania)\
**Post date:** [March 26, 2024, 12:39pm UTC](https://forum.keycloak.org/t/trigger-reset-password-every-x-days/25235/1 "2024-03-26T12:39:25Z")

</div>

Hello all,  
I was wondering if there is any option in keycloak (version 21.1.2) to trigger reset password every x days.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![vbauche](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/vbauche/32/10070_2.png) [@vbauche](https://forum.keycloak.org/u/vbauche)\
**Post date:** [March 27, 2024, 9:26am UTC](https://forum.keycloak.org/t/trigger-reset-password-every-x-days/25235/2 "2024-03-27T09:26:18Z")

</div>

Hello  
Just add a password policy…  
Be aware that the new password policy will apply only to new users

---

<div class="post-metadata">

**Author:** ![tania](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tania/32/9460_2.png) [@tania](https://forum.keycloak.org/u/tania)\
**Post date:** [March 27, 2024, 10:28am UTC](https://forum.keycloak.org/t/trigger-reset-password-every-x-days/25235/3 "2024-03-27T10:28:30Z")

</div>

@vbauche Password policy for the existing users how it can be applied via keycloak?

I can see that via the custom provider i have access to int daysToExpire = realm.getPasswordPolicy().getDaysToExpirePassword(); at the isValid method.

At the realm settings i don’t see anything related to setting up a password policy.

 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/2/23d81b5c0d835f8e3d7767237c4be94d45ca06a9.png)

Any advise on this?

---

<div class="post-metadata">

**Author:** ![vbauche](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/vbauche/32/10070_2.png) [@vbauche](https://forum.keycloak.org/u/vbauche)\
**Post date:** [March 27, 2024, 12:28pm UTC](https://forum.keycloak.org/t/trigger-reset-password-every-x-days/25235/4 "2024-03-27T12:28:37Z")

</div>

Password policy is not configured in Realm settings but in Authentication section :

 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/5/5666134ecbb9d7e482fa303de78e7fe7135b423b.png)

For existing users keycloak documentation says :  
The new policy will not be effective for existing users.

But I think it could work for the pasword exipation : you should test it

---

<div class="post-metadata">

**Author:** ![tania](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tania/32/9460_2.png) [@tania](https://forum.keycloak.org/u/tania)\
**Post date:** [March 27, 2024, 2:34pm UTC](https://forum.keycloak.org/t/trigger-reset-password-every-x-days/25235/5 "2024-03-27T14:34:57Z")

</div>

@vbauche Thank you very much!
