jazzband / django-rest-knox

Authentication Module for django rest auth
MIT License
1.18k stars 213 forks source link

TOKEN_TTL and TOKEN_LIMIT_PER_USER are mutually exclusive? #217

Open sophiasong93 opened 4 years ago

sophiasong93 commented 4 years ago

According to the logic in the post() method in https://github.com/James1345/django-rest-knox/blob/develop/knox/views.py If a user set the TOKEN_LIMIT_PER_USER, the token must have a expiry timestamp greater than current time.

token = request.user.auth_token_set.filter(expiry__gt=now)

However, there could also be a use case where user want to set a non-expiring token with TOKEN_TTL=None, but also have a token limit with TOKEN_LIMIT_PER_USER=X.

Could this be possible?