Fix behaviour of Token 'used' property
This commit is contained in:
parent
4b2ab3640c
commit
f28f13dea1
1 changed files with 3 additions and 2 deletions
|
@ -18,8 +18,9 @@ def storeToken(token):
|
|||
|
||||
def useToken(token):
|
||||
retval = False
|
||||
for t in Token.objects.filter(token=str(token).zfill(6)): # pylint: disable=E1101
|
||||
for t in Token.objects.filter(token=str(token).zfill(6), used=False): # pylint: disable=E1101
|
||||
t.used = True
|
||||
t.save()
|
||||
if timezone.now() - timedelta(seconds=300) < t.sent:
|
||||
retval = True
|
||||
return retval
|
||||
|
@ -53,4 +54,4 @@ def sendMessage(text, recipient):
|
|||
sendSMS(text, phone)
|
||||
|
||||
if telegram:
|
||||
sendTelegram(text, telegram)
|
||||
sendTelegram(text, telegram)
|
||||
|
|
Loading…
Reference in a new issue