factors: strip port for domain check

This commit is contained in:
Jens Langhammer 2020-02-18 17:05:30 +01:00
parent 591d2f89a1
commit 74ad1b6759
2 changed files with 3 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class OverviewView(LoginRequiredMixin, TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs["applications"] = [] kwargs["applications"] = []
for application in Application.objects.all().order_by('name'): for application in Application.objects.all().order_by("name"):
engine = PolicyEngine( engine = PolicyEngine(
application.policies.all(), self.request.user, self.request application.policies.all(), self.request.user, self.request
) )

View File

@ -53,6 +53,8 @@ class AuthenticationView(UserPassesTestMixin, View):
"""Checks if current request's domain matches configured Domain, and """Checks if current request's domain matches configured Domain, and
adds a warning if not.""" adds a warning if not."""
current_domain = self.request.get_host() current_domain = self.request.get_host()
if ":" in current_domain:
current_domain, _ = current_domain.split(":")
config_domain = CONFIG.y("domain") config_domain = CONFIG.y("domain")
if current_domain != config_domain: if current_domain != config_domain:
message = ( message = (