From 277c2f4aadaad6fee6eeb8163e5d0a831c5d26a6 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 5 Jun 2021 21:06:52 +0200 Subject: [PATCH] core: make application.meta_icon nullable Signed-off-by: Jens Langhammer #949 --- .../0025_alter_application_meta_icon.py | 20 +++++++++++++++++++ authentik/core/models.py | 4 +++- web/src/locales/en.po | 6 ++++++ web/src/locales/pseudo-LOCALE.po | 6 ++++++ web/src/pages/applications/ApplicationForm.ts | 13 ++++++++---- web/src/pages/flows/FlowForm.ts | 14 +++++++++---- 6 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 authentik/core/migrations/0025_alter_application_meta_icon.py diff --git a/authentik/core/migrations/0025_alter_application_meta_icon.py b/authentik/core/migrations/0025_alter_application_meta_icon.py new file mode 100644 index 000000000..cd4965b04 --- /dev/null +++ b/authentik/core/migrations/0025_alter_application_meta_icon.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.3 on 2021-06-05 19:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("authentik_core", "0024_alter_token_identifier"), + ] + + operations = [ + migrations.AlterField( + model_name="application", + name="meta_icon", + field=models.FileField( + default=None, null=True, upload_to="application-icons/" + ), + ), + ] diff --git a/authentik/core/models.py b/authentik/core/models.py index 08881172e..e76ac8c62 100644 --- a/authentik/core/models.py +++ b/authentik/core/models.py @@ -220,7 +220,9 @@ class Application(PolicyBindingModel): 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_icon = models.FileField( + upload_to="application-icons/", default=None, null=True + ) meta_description = models.TextField(default="", blank=True) meta_publisher = models.TextField(default="", blank=True) diff --git a/web/src/locales/en.po b/web/src/locales/en.po index 142413a47..36254bb97 100644 --- a/web/src/locales/en.po +++ b/web/src/locales/en.po @@ -349,10 +349,12 @@ msgstr "Authorized application:" msgid "Backends" msgstr "Backends" +#: src/pages/flows/FlowForm.ts #: src/pages/flows/FlowForm.ts msgid "Background" msgstr "Background" +#: src/pages/flows/FlowForm.ts #: src/pages/flows/FlowForm.ts #: src/pages/flows/FlowImportForm.ts msgid "Background shown during execution." @@ -946,6 +948,10 @@ msgstr "Created {0}" msgid "Creation Date" msgstr "Creation Date" +#: src/pages/flows/FlowForm.ts +msgid "Currently set to:" +msgstr "Currently set to:" + #: src/interfaces/AdminInterface.ts msgid "Customisation" msgstr "Customisation" diff --git a/web/src/locales/pseudo-LOCALE.po b/web/src/locales/pseudo-LOCALE.po index 681650f3c..aa45951cb 100644 --- a/web/src/locales/pseudo-LOCALE.po +++ b/web/src/locales/pseudo-LOCALE.po @@ -345,10 +345,12 @@ msgstr "" msgid "Backends" msgstr "" +#: #: msgid "Background" msgstr "" +#: #: #: msgid "Background shown during execution." @@ -940,6 +942,10 @@ msgstr "" msgid "Creation Date" msgstr "" +#: +msgid "Currently set to:" +msgstr "" + #: msgid "Customisation" msgstr "" diff --git a/web/src/pages/applications/ApplicationForm.ts b/web/src/pages/applications/ApplicationForm.ts index a80a7bea3..880546e4f 100644 --- a/web/src/pages/applications/ApplicationForm.ts +++ b/web/src/pages/applications/ApplicationForm.ts @@ -178,15 +178,20 @@ export class ApplicationForm extends ModelForm {

${t`If left empty, authentik will try to extract the launch URL based on the selected provider.`}

${until(config().then((c) => { - let type = "text"; if (c.capabilities.includes(CapabilitiesEnum.SaveMedia)) { - type = "file"; + return html` + + ${this.instance?.metaIcon ? html` +

${t`Currently set to:`} ${this.instance?.metaIcon}

+ `: html``} +
`; } return html` - - + `; }))} {

${t`Decides what this Flow is used for. For example, the Authentication flow is redirect to when an un-authenticated user visits authentik.`}

${until(config().then((c) => { - let type = "text"; if (c.capabilities.includes(CapabilitiesEnum.SaveMedia)) { - type = "file"; + return html` + + ${this.instance?.background ? html` +

${t`Currently set to:`} ${this.instance?.background}

+ `: html``} +

${t`Background shown during execution.`}

+
`; } return html` - - +

${t`Background shown during execution.`}

`; }))}