tenants: add separate field for favicon url

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-02 21:29:20 +02:00
parent 974ddc07f7
commit 3ea2b16a12
8 changed files with 56 additions and 1 deletions

View File

@ -32,6 +32,7 @@ class TenantSerializer(ModelSerializer):
"default", "default",
"branding_title", "branding_title",
"branding_logo", "branding_logo",
"branding_favicon",
"flow_authentication", "flow_authentication",
"flow_invalidation", "flow_invalidation",
"flow_recovery", "flow_recovery",
@ -45,6 +46,7 @@ class CurrentTenantSerializer(PassiveSerializer):
matched_domain = CharField(source="domain") matched_domain = CharField(source="domain")
branding_title = CharField() branding_title = CharField()
branding_logo = CharField() branding_logo = CharField()
branding_favicon = CharField()
ui_footer_links = ListField( ui_footer_links = ListField(
child=FooterLinkSerializer(), child=FooterLinkSerializer(),
read_only=True, read_only=True,

View File

@ -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'),
),
]

View File

@ -25,6 +25,9 @@ class Tenant(models.Model):
branding_logo = models.TextField( branding_logo = models.TextField(
default="/static/dist/assets/icons/icon_left_brand.svg" 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_authentication = models.ForeignKey(
Flow, null=True, on_delete=models.SET_NULL, related_name="tenant_authentication" Flow, null=True, on_delete=models.SET_NULL, related_name="tenant_authentication"

View File

@ -16537,6 +16537,8 @@ components:
type: string type: string
branding_logo: branding_logo:
type: string type: string
branding_favicon:
type: string
ui_footer_links: ui_footer_links:
type: array type: array
items: items:
@ -16550,6 +16552,7 @@ components:
flow_unenrollment: flow_unenrollment:
type: string type: string
required: required:
- branding_favicon
- branding_logo - branding_logo
- branding_title - branding_title
- matched_domain - matched_domain
@ -23153,6 +23156,8 @@ components:
type: string type: string
branding_logo: branding_logo:
type: string type: string
branding_favicon:
type: string
flow_authentication: flow_authentication:
type: string type: string
format: uuid format: uuid
@ -25177,6 +25182,8 @@ components:
type: string type: string
branding_logo: branding_logo:
type: string type: string
branding_favicon:
type: string
flow_authentication: flow_authentication:
type: string type: string
format: uuid format: uuid
@ -25210,6 +25217,8 @@ components:
type: string type: string
branding_logo: branding_logo:
type: string type: string
branding_favicon:
type: string
flow_authentication: flow_authentication:
type: string type: string
format: uuid format: uuid

View File

@ -38,7 +38,7 @@ export function tenant(): Promise<CurrentTenant> {
relIcon.rel = rel; relIcon.rel = rel;
document.getElementsByTagName('head')[0].appendChild(relIcon); document.getElementsByTagName('head')[0].appendChild(relIcon);
} }
relIcon.href = tenant.brandingLogo; relIcon.href = tenant.brandingFavicon;
}) })
return tenant; return tenant;
}); });

View File

@ -1464,6 +1464,10 @@ msgstr "Failed to delete {0}: {1}"
msgid "Failed to update {0}: {1}" msgid "Failed to update {0}: {1}"
msgstr "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 #: src/pages/stages/prompt/PromptListPage.ts
msgid "Field" msgid "Field"
msgstr "Field" msgstr "Field"
@ -1730,6 +1734,10 @@ msgstr "Icon"
msgid "Icon shown in sidebar/header and flow executor." msgid "Icon shown in sidebar/header and flow executor."
msgstr "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/flows/FlowListPage.ts
#: src/pages/system-tasks/SystemTaskListPage.ts #: src/pages/system-tasks/SystemTaskListPage.ts
#: src/pages/tokens/TokenListPage.ts #: src/pages/tokens/TokenListPage.ts

View File

@ -1456,6 +1456,10 @@ msgstr ""
msgid "Failed to update {0}: {1}" msgid "Failed to update {0}: {1}"
msgstr "" msgstr ""
#:
msgid "Favicon"
msgstr ""
#: #:
msgid "Field" msgid "Field"
msgstr "" msgstr ""
@ -1722,6 +1726,10 @@ msgstr ""
msgid "Icon shown in sidebar/header and flow executor." msgid "Icon shown in sidebar/header and flow executor."
msgstr "" msgstr ""
#:
msgid "Icon shown in the browser tab."
msgstr ""
#: #:
#: #:
#: #:

View File

@ -76,6 +76,13 @@ export class TenantForm extends ModelForm<Tenant, string> {
<input type="text" value="${first(this.instance?.brandingLogo, "/static/dist/assets/icons/icon_left_brand.svg")}" class="pf-c-form-control" required> <input type="text" value="${first(this.instance?.brandingLogo, "/static/dist/assets/icons/icon_left_brand.svg")}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${t`Icon shown in sidebar/header and flow executor.`}</p> <p class="pf-c-form__helper-text">${t`Icon shown in sidebar/header and flow executor.`}</p>
</ak-form-element-horizontal> </ak-form-element-horizontal>
<ak-form-element-horizontal
label=${t`Favicon`}
?required=${true}
name="brandingFavicon">
<input type="text" value="${first(this.instance?.brandingFavicon, "/static/dist/assets/icons/icon.png")}" class="pf-c-form-control" required>
<p class="pf-c-form__helper-text">${t`Icon shown in the browser tab.`}</p>
</ak-form-element-horizontal>
</div> </div>
</ak-form-group> </ak-form-group>
<ak-form-group> <ak-form-group>