From 0b6fb8ff5a23c41100adcf5c5e9f9f649c716d3e Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Thu, 8 Aug 2024 14:19:12 +0200 Subject: [PATCH] stages/authenticator: actually update last_used (#10813) --- authentik/stages/authenticator_validate/stage.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/authentik/stages/authenticator_validate/stage.py b/authentik/stages/authenticator_validate/stage.py index 62b1326227..96ae7e6215 100644 --- a/authentik/stages/authenticator_validate/stage.py +++ b/authentik/stages/authenticator_validate/stage.py @@ -5,6 +5,7 @@ from hashlib import sha256 from django.conf import settings from django.http import HttpRequest, HttpResponse +from django.utils.timezone import now from django.utils.translation import gettext_lazy as _ from jwt import PyJWTError, decode, encode 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.models import User +from authentik.events.middleware import audit_ignore from authentik.events.models import Event, EventAction from authentik.flows.challenge import ChallengeResponse, WithUserInfoChallenge 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.device ) + with audit_ignore(): + self.device.last_used = now() + self.device.save() return attrs