generate device with random name as we need to create them in the database

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-10-05 19:06:08 +02:00
parent bbfefc40d4
commit 94ffb224e3
No known key found for this signature in database
1 changed files with 2 additions and 0 deletions

View File

@ -10,6 +10,7 @@ from authentik.flows.challenge import (
WithUserInfoChallenge, WithUserInfoChallenge,
) )
from authentik.flows.stage import ChallengeStageView from authentik.flows.stage import ChallengeStageView
from authentik.lib.generators import generate_id
from authentik.stages.authenticator_mobile.models import MobileDevice, MobileDeviceToken from authentik.stages.authenticator_mobile.models import MobileDevice, MobileDeviceToken
FLOW_PLAN_MOBILE_ENROLL_TOKEN = "authentik/stages/authenticator_mobile/enroll/token" # nosec FLOW_PLAN_MOBILE_ENROLL_TOKEN = "authentik/stages/authenticator_mobile/enroll/token" # nosec
@ -47,6 +48,7 @@ class AuthenticatorMobileStageView(ChallengeStageView):
if FLOW_PLAN_MOBILE_ENROLL_TOKEN in self.executor.plan.context: if FLOW_PLAN_MOBILE_ENROLL_TOKEN in self.executor.plan.context:
return return
device = MobileDevice.objects.create( device = MobileDevice.objects.create(
name=generate_id(),
user=self.get_pending_user(), user=self.get_pending_user(),
stage=self.executor.current_stage, stage=self.executor.current_stage,
confirmed=False, confirmed=False,