From 83205f1b4975e22dc3810580c35e2152a11d45ca Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 26 Jul 2020 22:00:32 +0200 Subject: [PATCH] providers/app_gw: use full URL with protocol for internal/external_host --- .../migrations/0002_auto_20200726_1745.py | 24 +++++++++++++++++++ passbook/providers/app_gw/models.py | 5 ++-- .../app_gw/templates/app_gw/setup_modal.html | 4 ++-- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 passbook/providers/app_gw/migrations/0002_auto_20200726_1745.py diff --git a/passbook/providers/app_gw/migrations/0002_auto_20200726_1745.py b/passbook/providers/app_gw/migrations/0002_auto_20200726_1745.py new file mode 100644 index 000000000..09816b0dc --- /dev/null +++ b/passbook/providers/app_gw/migrations/0002_auto_20200726_1745.py @@ -0,0 +1,24 @@ +# Generated by Django 3.0.8 on 2020-07-26 17:45 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_providers_app_gw", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="applicationgatewayprovider", + name="external_host", + field=models.TextField(validators=[django.core.validators.URLValidator]), + ), + migrations.AlterField( + model_name="applicationgatewayprovider", + name="internal_host", + field=models.TextField(validators=[django.core.validators.URLValidator]), + ), + ] diff --git a/passbook/providers/app_gw/models.py b/passbook/providers/app_gw/models.py index c192d5d76..02f852d8b 100644 --- a/passbook/providers/app_gw/models.py +++ b/passbook/providers/app_gw/models.py @@ -3,6 +3,7 @@ import string from random import SystemRandom from typing import Optional, Type +from django.core.validators import URLValidator from django.db import models from django.forms import ModelForm from django.http import HttpRequest @@ -20,8 +21,8 @@ class ApplicationGatewayProvider(Provider): Protocols by using a Reverse-Proxy.""" name = models.TextField() - internal_host = models.TextField() - external_host = models.TextField() + internal_host = models.TextField(validators=[URLValidator]) + external_host = models.TextField(validators=[URLValidator]) client = models.ForeignKey(Client, on_delete=models.CASCADE) diff --git a/passbook/providers/app_gw/templates/app_gw/setup_modal.html b/passbook/providers/app_gw/templates/app_gw/setup_modal.html index f4de2c203..d18eebaf1 100644 --- a/passbook/providers/app_gw/templates/app_gw/setup_modal.html +++ b/passbook/providers/app_gw/templates/app_gw/setup_modal.html @@ -49,8 +49,8 @@ {% trans 'Here' %}

{% trans 'Afterwards, add the following annotations to the Ingress you want to secure:' %}