# Block users after certain inactivity period

**URL:** <https://community.auth0.com/t/block-users-after-certain-inactivity-period/53531>\
**Category:** Get Help\
**Tags:** rules, users, block\
**Created:** [November 19, 2020, 4:46pm UTC](https://community.auth0.com/t/block-users-after-certain-inactivity-period/53531 "2020-11-19T16:46:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![romandubrov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/romandubrov/32/24945_2.png) [@romandubrov](https://community.auth0.com/u/romandubrov)\
**Post date:** [November 19, 2020, 4:46pm UTC](https://community.auth0.com/t/block-users-after-certain-inactivity-period/53531/1 "2020-11-19T16:46:27Z")

</div>

Hi there,

In order to pass HIPAA certification we need to block username-password users that weren’t active for certain time. There is no such option available out of the box in management panel, and there is also no field in `user` or `context` that could indicate that user passed all auth stages (password, MFA forced conditionally from a rule, other rules that may throw `UnauthorizedError` for some other reason)

Am I missing something? Any ideas how to implement this?

We are using `auth0-spa-js` with popup on the app side, so there are no redirects (not sure if this is important)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 19, 2020, 8:41pm UTC](https://community.auth0.com/t/block-users-after-certain-inactivity-period/53531/3 "2020-11-19T20:41:27Z")

</div>

Hi @romandubrov,

Welcome to the Community!

You can use the app\_metadata property to set this up.

Here is an excellent write up from @joseantonio.rey:

> [@Last\_login not available in user object in custom rule](https://community.auth0.com/t/last-login-not-available-in-user-object-in-custom-rule/17538/3):
>
> Hello! This is because there would be a caveat: rules execute after a successful authentication, meaning that the last\_login value would be the value for the current time and date. What you could do is set the value to the app\_metadata, and grab it from there. Your rule would look something like this: user.app\_metadata = user.app\_metadata || {}; // Grab the current value of last login and print it var previous\_login = user.app\_metadata.previous\_login console.log(previous\_logi…

---

<div class="post-metadata">

**Author:** ![romandubrov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/romandubrov/32/24945_2.png) [@romandubrov](https://community.auth0.com/u/romandubrov)\
**Post date:** [November 20, 2020, 8:03am UTC](https://community.auth0.com/t/block-users-after-certain-inactivity-period/53531/4 "2020-11-20T08:03:53Z")

</div>

Hi @dan.woda,

Unfortunately this does not work for me. I need to set a value to user\_metadata only when user has passed MFA and other rules that may throw. I created a rule to update user\_metadata and put it at the end of rules list, and it was executed before passing MFA or after previous rule thrown an error. I looked to user and context objects but seems there is no way to know that user successfully passed previous steps and rules.
