From 23de9df2a5ae41014e737fac36cdb04d348c3f79 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 2 Mar 2021 22:20:54 +0100 Subject: [PATCH] stages/authenticator_validate: cleanup --- .../stages/authenticator_validate/forms.py | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/authentik/stages/authenticator_validate/forms.py b/authentik/stages/authenticator_validate/forms.py index 12e5ea97d..d4213a123 100644 --- a/authentik/stages/authenticator_validate/forms.py +++ b/authentik/stages/authenticator_validate/forms.py @@ -1,9 +1,7 @@ """OTP Validate stage forms""" from django import forms from django.utils.translation import gettext_lazy as _ -from django_otp import match_token -from authentik.core.models import User from authentik.flows.models import NotConfiguredAction from authentik.stages.authenticator_validate.models import ( AuthenticatorValidateStage, @@ -11,35 +9,6 @@ from authentik.stages.authenticator_validate.models import ( ) -class ValidationForm(forms.Form): - """OTP Validate stage forms""" - - user: User - - code = forms.CharField( - label=_("Please enter the token from your device."), - widget=forms.TextInput( - attrs={ - "autocomplete": "one-time-code", - "placeholder": "123456", - "autofocus": "autofocus", - } - ), - ) - - def __init__(self, user, *args, **kwargs): - super().__init__(*args, **kwargs) - self.user = user - - def clean_code(self): - """Validate code against all confirmed devices""" - code = self.cleaned_data.get("code") - device = match_token(self.user, code) - if not device: - raise forms.ValidationError(_("Invalid Token")) - return code - - class AuthenticatorValidateStageForm(forms.ModelForm): """OTP Validate stage forms"""