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

AUTO_REFRESH method never worked #291

Open
laksithakumara-cb opened this issue Dec 6, 2022 · 3 comments
Open

AUTO_REFRESH method never worked #291

laksithakumara-cb opened this issue Dec 6, 2022 · 3 comments

Comments

@laksithakumara-cb
Copy link

Hello Know Team,

I tried this module, and its looks amazing, but I just noticed one thing on this app. its regarding the Auto Refresh method.

if auth_token.expiry is not None: if auth_token.expiry < timezone.now(): username = auth_token.user.get_username() auth_token.delete() token_expired.send(sender=self.__class__, username=username, source="auth_token") return True

above code line auto delete token if already expired even AUTO_REFRESH = True

@laksithakumara-cb
Copy link
Author

    def _cleanup_token(self, auth_token):
        for other_token in auth_token.user.auth_token_set.all():
            if other_token.digest != auth_token.digest and other_token.expiry:
                if other_token.expiry < timezone.now():
                    other_token.delete()
                    username = other_token.user.get_username()
                    token_expired.send(sender=self.__class__,
                                       username=username, source="other_token")
        if auth_token.expiry is not None:
            if auth_token.expiry < timezone.now():
                username = auth_token.user.get_username()
                auth_token.delete()
                token_expired.send(sender=self.__class__,
                                   username=username, source="auth_token")
                return True
        return False

@laksithakumara-cb
Copy link
Author

This code line should be like this.

if knox_settings.AUTO_REFRESH == False and auth_token.expiry is not None:

@winmorre
Copy link

winmorre commented Dec 6, 2022

Can I pick this up?

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

No branches or pull requests

2 participants