Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

adds activity timeout to version 2.x #55

Merged
merged 3 commits into from
Aug 13, 2024
Merged

Conversation

opheus2
Copy link
Contributor

@opheus2 opheus2 commented Aug 13, 2024

This PR adds the ability to add a timeout to automatically lock session if no activity after a set duration of time.

usage

//
use lockscreen\FilamentLockscreen\Http\Middleware\LockerTimer;

//

 $panel->middleware([
      //
      LockerTimer::class,
  ])

@opheus2 opheus2 marked this pull request as ready for review August 13, 2024 10:25
@opheus2 opheus2 changed the title add activity timeout adds activity timeout to version 2.x Aug 13, 2024
@MarJose123
Copy link
Owner

Hi @opheus2 Thank you for your PR.

I would like to take some time to understand the possible cause of this since the logic is only using the middleware instead of mouse or keyboard activity.

I'm thinking to have like this implemented in the frontend rather than in the middleware. Probably similar to this library to detect user activity.

https://vueuse.org/core/useIdle/#useidle

@MarJose123 MarJose123 marked this pull request as draft August 13, 2024 11:07
@opheus2
Copy link
Contributor Author

opheus2 commented Aug 13, 2024

I believe a backend approach is preferable for this, as it's more of a security enhancement.

So, we would just need to include the last activity time in a session for each request, which is quite simple.

If there's no activity for the specified period, we will set the session's lock screen to true. This would be detected during the next request, and the user would need to log in again.

It's simple and straightforward but it's a great addition for people using filament as an admin panel for admins only
@MarJose123

@opheus2
Copy link
Contributor Author

opheus2 commented Aug 13, 2024

BTW you only need to add the middleware if you need to use it. So there is no breaking change

@opheus2 opheus2 requested a review from MarJose123 August 13, 2024 11:41
Copy link
Owner

@MarJose123 MarJose123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🍻

@MarJose123 MarJose123 marked this pull request as ready for review August 13, 2024 12:07
@MarJose123 MarJose123 merged commit 1122360 into MarJose123:2.x Aug 13, 2024
1 check passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants