From 3ea2b16a128b46bc08857ba213b4651ad53a00bb Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 2 Jun 2021 21:29:20 +0200 Subject: [PATCH] tenants: add separate field for favicon url Signed-off-by: Jens Langhammer --- authentik/tenants/api.py | 2 ++ .../migrations/0003_tenant_branding_favicon.py | 18 ++++++++++++++++++ authentik/tenants/models.py | 3 +++ schema.yml | 9 +++++++++ web/src/api/Config.ts | 2 +- web/src/locales/en.po | 8 ++++++++ web/src/locales/pseudo-LOCALE.po | 8 ++++++++ web/src/pages/tenants/TenantForm.ts | 7 +++++++ 8 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 authentik/tenants/migrations/0003_tenant_branding_favicon.py diff --git a/authentik/tenants/api.py b/authentik/tenants/api.py index 74acbc57a..4a40453ac 100644 --- a/authentik/tenants/api.py +++ b/authentik/tenants/api.py @@ -32,6 +32,7 @@ class TenantSerializer(ModelSerializer): "default", "branding_title", "branding_logo", + "branding_favicon", "flow_authentication", "flow_invalidation", "flow_recovery", @@ -45,6 +46,7 @@ class CurrentTenantSerializer(PassiveSerializer): matched_domain = CharField(source="domain") branding_title = CharField() branding_logo = CharField() + branding_favicon = CharField() ui_footer_links = ListField( child=FooterLinkSerializer(), read_only=True, diff --git a/authentik/tenants/migrations/0003_tenant_branding_favicon.py b/authentik/tenants/migrations/0003_tenant_branding_favicon.py new file mode 100644 index 000000000..32b88dc64 --- /dev/null +++ b/authentik/tenants/migrations/0003_tenant_branding_favicon.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.3 on 2021-06-02 19:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('authentik_tenants', '0002_default'), + ] + + operations = [ + migrations.AddField( + model_name='tenant', + name='branding_favicon', + field=models.TextField(default='/static/dist/assets/icons/icon.png'), + ), + ] diff --git a/authentik/tenants/models.py b/authentik/tenants/models.py index 9ad6b5db1..1bc618914 100644 --- a/authentik/tenants/models.py +++ b/authentik/tenants/models.py @@ -25,6 +25,9 @@ class Tenant(models.Model): branding_logo = models.TextField( default="/static/dist/assets/icons/icon_left_brand.svg" ) + branding_favicon = models.TextField( + default="/static/dist/assets/icons/icon.png" + ) flow_authentication = models.ForeignKey( Flow, null=True, on_delete=models.SET_NULL, related_name="tenant_authentication" diff --git a/schema.yml b/schema.yml index 4f1c52579..5ca821759 100644 --- a/schema.yml +++ b/schema.yml @@ -16537,6 +16537,8 @@ components: type: string branding_logo: type: string + branding_favicon: + type: string ui_footer_links: type: array items: @@ -16550,6 +16552,7 @@ components: flow_unenrollment: type: string required: + - branding_favicon - branding_logo - branding_title - matched_domain @@ -23153,6 +23156,8 @@ components: type: string branding_logo: type: string + branding_favicon: + type: string flow_authentication: type: string format: uuid @@ -25177,6 +25182,8 @@ components: type: string branding_logo: type: string + branding_favicon: + type: string flow_authentication: type: string format: uuid @@ -25210,6 +25217,8 @@ components: type: string branding_logo: type: string + branding_favicon: + type: string flow_authentication: type: string format: uuid diff --git a/web/src/api/Config.ts b/web/src/api/Config.ts index 49c17aaee..c9761e3a9 100644 --- a/web/src/api/Config.ts +++ b/web/src/api/Config.ts @@ -38,7 +38,7 @@ export function tenant(): Promise { relIcon.rel = rel; document.getElementsByTagName('head')[0].appendChild(relIcon); } - relIcon.href = tenant.brandingLogo; + relIcon.href = tenant.brandingFavicon; }) return tenant; }); diff --git a/web/src/locales/en.po b/web/src/locales/en.po index b8fb7589d..30f52546a 100644 --- a/web/src/locales/en.po +++ b/web/src/locales/en.po @@ -1464,6 +1464,10 @@ msgstr "Failed to delete {0}: {1}" msgid "Failed to update {0}: {1}" msgstr "Failed to update {0}: {1}" +#: src/pages/tenants/TenantForm.ts +msgid "Favicon" +msgstr "Favicon" + #: src/pages/stages/prompt/PromptListPage.ts msgid "Field" msgstr "Field" @@ -1730,6 +1734,10 @@ msgstr "Icon" msgid "Icon shown in sidebar/header and flow executor." msgstr "Icon shown in sidebar/header and flow executor." +#: src/pages/tenants/TenantForm.ts +msgid "Icon shown in the browser tab." +msgstr "Icon shown in the browser tab." + #: src/pages/flows/FlowListPage.ts #: src/pages/system-tasks/SystemTaskListPage.ts #: src/pages/tokens/TokenListPage.ts diff --git a/web/src/locales/pseudo-LOCALE.po b/web/src/locales/pseudo-LOCALE.po index a415b2a3e..5d85052ca 100644 --- a/web/src/locales/pseudo-LOCALE.po +++ b/web/src/locales/pseudo-LOCALE.po @@ -1456,6 +1456,10 @@ msgstr "" msgid "Failed to update {0}: {1}" msgstr "" +#: +msgid "Favicon" +msgstr "" + #: msgid "Field" msgstr "" @@ -1722,6 +1726,10 @@ msgstr "" msgid "Icon shown in sidebar/header and flow executor." msgstr "" +#: +msgid "Icon shown in the browser tab." +msgstr "" + #: #: #: diff --git a/web/src/pages/tenants/TenantForm.ts b/web/src/pages/tenants/TenantForm.ts index 89976fae2..dce703b5a 100644 --- a/web/src/pages/tenants/TenantForm.ts +++ b/web/src/pages/tenants/TenantForm.ts @@ -76,6 +76,13 @@ export class TenantForm extends ModelForm {

${t`Icon shown in sidebar/header and flow executor.`}

+ + +

${t`Icon shown in the browser tab.`}

+