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

Allow for custom expiration based on request #65

Merged
merged 1 commit into from
Apr 12, 2016

Conversation

mjschultz
Copy link
Contributor

This breaks out an get_expire_seconds method that simply gets the EXPIRE_AFTER value from the config. My thinking is that this should allow things like #58 to be solved by the end-user easily though creating a new middleware that overrides the get_expire_seconds method. For example, if they want per-user settings they'd have to create a User Profile model to store the timeout, then they could just do something like:

class MySessionSecurityMiddleware(SessionSecurityMiddleware):
    def get_expire_seconds(self, request):
        try:
            return request.user.profile.session_timeout
        except Exception:
            return settings.EXPIRE_AFTER

(* example not guaranteed to work)

@jpic jpic merged commit d0dacbb into yourlabs:stable/2.x.x Apr 12, 2016
@mjschultz mjschultz deleted the get-timeout branch April 13, 2016 01:26
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.

None yet

2 participants