From 06b7f62a402e0342bdcdc2c5a8a5f4bb25e35351 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 3 Jun 2021 00:21:20 +0200 Subject: [PATCH] core: make app's meta_launch_url textfield Signed-off-by: Jens Langhammer --- .../0023_alter_application_meta_launch_url.py | 23 +++++++++++++++++++ authentik/core/models.py | 5 +++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 authentik/core/migrations/0023_alter_application_meta_launch_url.py diff --git a/authentik/core/migrations/0023_alter_application_meta_launch_url.py b/authentik/core/migrations/0023_alter_application_meta_launch_url.py new file mode 100644 index 000000000..2a313c8e6 --- /dev/null +++ b/authentik/core/migrations/0023_alter_application_meta_launch_url.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.3 on 2021-06-02 21:51 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("authentik_core", "0022_authenticatedsession"), + ] + + operations = [ + migrations.AlterField( + model_name="application", + name="meta_launch_url", + field=models.TextField( + blank=True, + default="", + validators=[django.core.validators.URLValidator()], + ), + ), + ] diff --git a/authentik/core/models.py b/authentik/core/models.py index 71141f157..386f826cb 100644 --- a/authentik/core/models.py +++ b/authentik/core/models.py @@ -8,6 +8,7 @@ from uuid import uuid4 from django.conf import settings from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import UserManager as DjangoUserManager +from django.core import validators from django.db import models from django.db.models import Q, QuerySet from django.http import HttpRequest @@ -215,7 +216,9 @@ class Application(PolicyBindingModel): "Provider", null=True, blank=True, default=None, on_delete=models.SET_DEFAULT ) - meta_launch_url = models.URLField(default="", blank=True) + meta_launch_url = models.TextField( + default="", blank=True, validators=[validators.URLValidator()] + ) # For template applications, this can be set to /static/authentik/applications/* meta_icon = models.FileField(upload_to="application-icons/", default="", blank=True) meta_description = models.TextField(default="", blank=True)