fix tests and lint
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
8797b6309f
commit
63fea84405
|
@ -169,6 +169,7 @@ class License(SerializerModel):
|
|||
|
||||
@classmethod
|
||||
def non_expired(cls) -> QuerySet["License"]:
|
||||
"""Filter all non expired licenses"""
|
||||
return License.objects.filter(expiry__gte=now())
|
||||
|
||||
@property
|
||||
|
|
|
@ -8,8 +8,8 @@ from grpc import (
|
|||
UnaryUnaryClientInterceptor,
|
||||
insecure_channel,
|
||||
intercept_channel,
|
||||
ssl_channel_credentials,
|
||||
secure_channel,
|
||||
ssl_channel_credentials,
|
||||
)
|
||||
from grpc._interceptor import _ClientCallDetails
|
||||
|
||||
|
@ -58,10 +58,10 @@ def get_enterprise_token() -> str:
|
|||
try:
|
||||
from authentik.enterprise.models import License
|
||||
|
||||
license = License.non_expired().order_by("-expiry").first()
|
||||
if not license:
|
||||
valid_license = License.non_expired().order_by("-expiry").first()
|
||||
if not valid_license:
|
||||
return get_install_id()
|
||||
return license.key
|
||||
return valid_license.key
|
||||
except ImportError:
|
||||
return get_install_id()
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ from django.http import HttpRequest
|
|||
from django.utils.translation import gettext as __
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views import View
|
||||
from grpc import RpcError
|
||||
from rest_framework.serializers import BaseSerializer, Serializer
|
||||
from structlog.stdlib import get_logger
|
||||
|
||||
|
@ -201,8 +200,6 @@ class MobileTransaction(ExpiringModel):
|
|||
)
|
||||
)
|
||||
LOGGER.debug("Sent notification", id=response, tx_id=self.tx_id)
|
||||
except RpcError as exc:
|
||||
LOGGER.warning("failed to push", exc=exc, code=exc.code(), tx_id=self.tx_id)
|
||||
except ValueError as exc:
|
||||
LOGGER.warning("failed to push", exc=exc, tx_id=self.tx_id)
|
||||
return True
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"""Mobile stage"""
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
from rest_framework.fields import CharField
|
||||
from django.conf import settings
|
||||
|
||||
from authentik.core.api.utils import PassiveSerializer
|
||||
from authentik.flows.challenge import (
|
||||
Challenge,
|
||||
|
|
|
@ -130,9 +130,8 @@ class AuthenticatorValidationChallengeResponse(ChallengeResponse):
|
|||
device = MobileDevice.objects.filter(pk=challenge.get("device_uid")).first()
|
||||
case "sms":
|
||||
device = SMSDevice.objects.filter(pk=int(challenge.get("device_uid"))).first()
|
||||
if not device:
|
||||
raise ValidationError("invalid challenge selected")
|
||||
select_challenge(self.stage.request, self.stage, device)
|
||||
if device:
|
||||
select_challenge(self.stage.request, self.stage, device)
|
||||
return challenge
|
||||
|
||||
def validate_selected_stage(self, stage_pk: str) -> str:
|
||||
|
|
|
@ -95,7 +95,9 @@ extension-pkg-whitelist = ["lxml", "xmlsec"]
|
|||
# Allow constants to be shorter than normal (and lowercase, for settings.py)
|
||||
const-rgx = "[a-zA-Z0-9_]{1,40}$"
|
||||
|
||||
ignored-modules = ["binascii", "socket", "zlib"]
|
||||
ignored-modules = [
|
||||
"authentik_cloud_gateway_client"
|
||||
]
|
||||
generated-members = ["xmlsec.constants.*", "xmlsec.tree.*", "xmlsec.template.*"]
|
||||
ignore = ["migrations", "tests"]
|
||||
max-attributes = 12
|
||||
|
|
Reference in New Issue