Skip to content

Commit

Permalink
Add CHECK_EXPIRED_TEMP_TOKEN setting to disable check for expired tok…
Browse files Browse the repository at this point in the history
…en. (#1149)
  • Loading branch information
ukanga authored Oct 11, 2017
1 parent d3c6dd5 commit 7ae5016
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion onadata/libs/serializers/user_profile_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,10 @@ def get_api_token(self, object):
def get_temp_token(self, object):
"""This should return a valid temp token for this user profile."""
token, created = TempToken.objects.get_or_create(user=object.user)
check_expired = getattr(settings, 'CHECK_EXPIRED_TEMP_TOKEN', True)

try:
if not created and expired(token.created):
if check_expired and not created and expired(token.created):
with transaction.atomic():
TempToken.objects.get(user=object.user).delete()
token = TempToken.objects.create(user=object.user)
Expand Down

0 comments on commit 7ae5016

Please sign in to comment.