User Account creation form - changes

Is it possible to make the Account Expiration Date field mandatory when creating a user in DHIS2? How can we achieve this?

1 Like

Hi Hiral!

Thank you for your inquiry. To begin with, there’s a ‘require user account password change’ that the admin can enforce for all users:

However, it’s not the same as ‘account expiration’, the account expiration is set by updating the user’s info in the user system setting:

Or with an API PATCH request to user_id https://play.im.dhis2.org/stable-2-42-4/api/42/users/{user_id} and payload: [{"op":"add","path":"/accountExpiry","value":"[date here such as 2026-04-21 without the square brackets]"},{"op":"add","path":"/attributeValues","value":[]}]


Although I thought of some workarounds, this appears to be a feature request (please see ideas if you’d like to make a request and it’d be greatly helpful to know the use-case and why this is needed in the field).

As a workaround, if this is critical in your implementation, you could do one of these options:

  1. disable self-registration, and create a “custom registration” app that users will use to create their accounts but the app will use the API to create the user with an ‘expiration date’.
  2. Run a regular API script (either using Postman Runner or a serverless service like Vercel) to go over list of the user’s you’d like to set an expiration date for.

There are probably much more workarounds but it all depends on your use-case. I hope these suggestions help.

Thanks!