stages/authenticator: actually update last_used (#10813)
This commit is contained in:
committed by
GitHub
parent
fd0127ae2a
commit
0b6fb8ff5a
@ -5,6 +5,7 @@ from hashlib import sha256
|
|||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from jwt import PyJWTError, decode, encode
|
from jwt import PyJWTError, decode, encode
|
||||||
from rest_framework.fields import CharField, IntegerField, ListField, UUIDField
|
from rest_framework.fields import CharField, IntegerField, ListField, UUIDField
|
||||||
@ -12,6 +13,7 @@ from rest_framework.serializers import ValidationError
|
|||||||
|
|
||||||
from authentik.core.api.utils import JSONDictField, PassiveSerializer
|
from authentik.core.api.utils import JSONDictField, PassiveSerializer
|
||||||
from authentik.core.models import User
|
from authentik.core.models import User
|
||||||
|
from authentik.events.middleware import audit_ignore
|
||||||
from authentik.events.models import Event, EventAction
|
from authentik.events.models import Event, EventAction
|
||||||
from authentik.flows.challenge import ChallengeResponse, WithUserInfoChallenge
|
from authentik.flows.challenge import ChallengeResponse, WithUserInfoChallenge
|
||||||
from authentik.flows.exceptions import FlowSkipStageException, StageInvalidException
|
from authentik.flows.exceptions import FlowSkipStageException, StageInvalidException
|
||||||
@ -143,6 +145,9 @@ class AuthenticatorValidationChallengeResponse(ChallengeResponse):
|
|||||||
self.stage.executor.plan.context[PLAN_CONTEXT_METHOD_ARGS]["mfa_devices"].append(
|
self.stage.executor.plan.context[PLAN_CONTEXT_METHOD_ARGS]["mfa_devices"].append(
|
||||||
self.device
|
self.device
|
||||||
)
|
)
|
||||||
|
with audit_ignore():
|
||||||
|
self.device.last_used = now()
|
||||||
|
self.device.save()
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user