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",
"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,

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(
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"

View File

@ -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

View File

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

View File

@ -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

View File

@ -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 ""
#:
#:
#:

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>
<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
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>
</ak-form-group>
<ak-form-group>