fix lint
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
c0262f0802
commit
a1c1c3a27c
|
@ -228,7 +228,7 @@ class User(SerializerModel, GuardianUserMixin, AbstractUser):
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
LOGGER.warning("Failed to get default locale", exc=exc)
|
LOGGER.warning("Failed to get default locale", exc=exc)
|
||||||
if request:
|
if request:
|
||||||
return get_tenant(request).locale
|
return get_tenant(request).default_locale
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -26,6 +26,7 @@ from authentik.stages.consent.stage import (
|
||||||
PLAN_CONTEXT_CONSENT_HEADER,
|
PLAN_CONTEXT_CONSENT_HEADER,
|
||||||
PLAN_CONTEXT_CONSENT_PERMISSIONS,
|
PLAN_CONTEXT_CONSENT_PERMISSIONS,
|
||||||
)
|
)
|
||||||
|
from authentik.tenants.utils import get_tenant
|
||||||
|
|
||||||
|
|
||||||
class RedirectToAppLaunch(View):
|
class RedirectToAppLaunch(View):
|
||||||
|
|
|
@ -60,7 +60,7 @@ from authentik.lib.utils.errors import exception_to_string
|
||||||
from authentik.lib.utils.reflection import all_subclasses, class_to_path
|
from authentik.lib.utils.reflection import all_subclasses, class_to_path
|
||||||
from authentik.lib.utils.urls import is_url_absolute, redirect_with_qs
|
from authentik.lib.utils.urls import is_url_absolute, redirect_with_qs
|
||||||
from authentik.policies.engine import PolicyEngine
|
from authentik.policies.engine import PolicyEngine
|
||||||
from authentik.tenants.models import Tenant
|
from authentik.tenants.utils import get_tenant
|
||||||
|
|
||||||
LOGGER = get_logger()
|
LOGGER = get_logger()
|
||||||
# Argument used to redirect user after login
|
# Argument used to redirect user after login
|
||||||
|
@ -481,7 +481,7 @@ class ToDefaultFlow(View):
|
||||||
|
|
||||||
def get_flow(self) -> Flow:
|
def get_flow(self) -> Flow:
|
||||||
"""Get a flow for the selected designation"""
|
"""Get a flow for the selected designation"""
|
||||||
tenant: Tenant = self.request.tenant
|
tenant = get_tenant(self.request)
|
||||||
flow = None
|
flow = None
|
||||||
# First, attempt to get default flow from tenant
|
# First, attempt to get default flow from tenant
|
||||||
if self.designation == FlowDesignation.AUTHENTICATION:
|
if self.designation == FlowDesignation.AUTHENTICATION:
|
||||||
|
|
|
@ -40,8 +40,6 @@ def get_tenant(request: HttpRequest | Request) -> "Tenant":
|
||||||
|
|
||||||
def lookup_tenant_for_request(request: HttpRequest) -> "Tenant":
|
def lookup_tenant_for_request(request: HttpRequest) -> "Tenant":
|
||||||
"""Get tenant object for current request"""
|
"""Get tenant object for current request"""
|
||||||
from authentik.tenants.models import Tenant
|
|
||||||
|
|
||||||
db_tenants = (
|
db_tenants = (
|
||||||
Tenant.objects.annotate(host_domain=V(request.get_host()))
|
Tenant.objects.annotate(host_domain=V(request.get_host()))
|
||||||
.filter(Q(host_domain__iendswith=F("domain")) | _q_default)
|
.filter(Q(host_domain__iendswith=F("domain")) | _q_default)
|
||||||
|
|
Reference in New Issue