session limit enforcement

* upon creating a new session, invalidate oldest sessions
This commit is contained in:
Chris Meyers
2015-09-28 10:53:49 -04:00
parent 531fc4d8ed
commit 000d26d7e3
9 changed files with 731 additions and 28 deletions

View File

@@ -55,11 +55,11 @@ class TowerBaseNamespace(BaseNamespace):
k, v = self.environ['QUERY_STRING'].split("=")
if k == "Token":
token_actual = urllib.unquote_plus(v).decode().replace("\"","")
auth_token = AuthToken.objects.filter(key=token_actual)
auth_token = AuthToken.objects.filter(key=token_actual, reason='')
if not auth_token.exists():
return False
auth_token = auth_token[0]
if not auth_token.expired:
if not auth_token.is_expired():
return auth_token.user
else:
return False