Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[draft] [feat]: template for limit session count #23

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mustafadeel
Copy link

Changes

Adding a template for limiting session counts as defined in this repo:
https://github.com/abbaspour/actions-gallery/blob/main/post-login/session-count/limit-session-count.js

  • I described the changes on this PR.

References

https://github.com/abbaspour/actions-gallery/blob/main/post-login/session-count/limit-session-count.js

  • I added at least one link to explain why this change is needed.

Checklist

@nelsonmaia
Copy link
Contributor

I would consider using session.revoke instead of access.deny for when the count is > MAX_SESSION.

Instead of

if (count >= MAX_SESSION) { api.access.deny('max sessions reached'); }

I would use 

`if (count >= MAX_SESSION) {
    api.session.revoke('max sessions reached');
}`

While both will deny the user authentication, using access.deny won't invalidate the session and if the user clicks login again, he will be redirected straight to the same error page. This UX can be confusing for the user.

Using session.revoke, when the user clicks login, credentails will be asked again

@mustafadeel
Copy link
Author

mustafadeel commented Sep 16, 2024

I would consider using session.revoke instead of access.deny for when the count is > MAX_SESSION.

Instead of

if (count >= MAX_SESSION) { api.access.deny('max sessions reached'); }

I would use 

`if (count >= MAX_SESSION) {
    api.session.revoke('max sessions reached');
}`

While both will deny the user authentication, using access.deny won't invalidate the session and if the user clicks login again, he will be redirected straight to the same error page. This UX can be confusing for the user.

Using session.revoke, when the user clicks login, credentails will be asked again

thanks! i've updated it. Small note, also changed to > MAX_SESSIONS instead of >= :)

@mustafadeel mustafadeel marked this pull request as ready for review September 19, 2024 15:13
@mustafadeel mustafadeel requested a review from a team as a code owner September 19, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants