Update last_login in each api call
parent
49650db332
commit
0ede2a67be
|
@ -37,6 +37,8 @@ fraudulent modifications.
|
|||
import re
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
from datetime import timedelta
|
||||
from taiga.base.api.authentication import BaseAuthentication
|
||||
|
||||
from .tokens import get_user_for_token
|
||||
|
@ -86,6 +88,10 @@ class Token(BaseAuthentication):
|
|||
user = get_user_for_token(token, "authentication",
|
||||
max_age=max_age_auth_token)
|
||||
|
||||
if user.last_login < (timezone.now() - timedelta(minutes=1)):
|
||||
user.last_login = timezone.now()
|
||||
user.save(update_fields=["last_login"])
|
||||
|
||||
return (user, token)
|
||||
|
||||
def authenticate_header(self, request):
|
||||
|
|
Loading…
Reference in New Issue