core: remove UILoginButton's icon_path

This commit is contained in:
Jens Langhammer 2021-02-20 18:26:36 +01:00
parent 391ee10cb8
commit 0e975757b8
6 changed files with 8 additions and 13 deletions

View File

@ -28,10 +28,8 @@
{% for source in sources %} {% for source in sources %}
<li class="pf-c-login__main-footer-links-item"> <li class="pf-c-login__main-footer-links-item">
<a href="{{ source.url }}" class="pf-c-login__main-footer-links-item-link"> <a href="{{ source.url }}" class="pf-c-login__main-footer-links-item-link">
{% if source.icon_path %} {% if source.icon_url %}
<img src="{% static source.icon_path %}" alt="{{ source.name }}"> <img src="{{ source.icon_url }}" alt="{{ source.name }}">
{% elif source.icon_url %}
<img src="icon_url" alt="{{ source.name }}">
{% else %} {% else %}
<i class="pf-icon pf-icon-arrow" title="{{ source.name }}"></i> <i class="pf-icon pf-icon-arrow" title="{{ source.name }}"></i>
{% endif %} {% endif %}

View File

@ -1,5 +1,7 @@
{% extends "base/skeleton.html" %} {% extends "base/skeleton.html" %}
{% load static %}
{% block head %} {% block head %}
<script src="{% static 'dist/main.js' %}?v={{ ak_version }}" type="module"></script> <script src="{% static 'dist/main.js' %}?v={{ ak_version }}" type="module"></script>
{% endblock %} {% endblock %}

View File

@ -13,8 +13,5 @@ class UILoginButton:
# URL Which Button points to # URL Which Button points to
url: str url: str
# Icon name, ran through django's static
icon_path: Optional[str] = None
# Icon URL, used as-is # Icon URL, used as-is
icon_url: Optional[str] = None icon_url: Optional[str] = None

View File

@ -6,6 +6,7 @@ from django.forms import ModelForm
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from rest_framework.serializers import Serializer from rest_framework.serializers import Serializer
from django.templatetags.static import static
from authentik.core.models import Source, UserSourceConnection from authentik.core.models import Source, UserSourceConnection
from authentik.core.types import UILoginButton from authentik.core.types import UILoginButton
@ -60,7 +61,7 @@ class OAuthSource(Source):
"authentik_sources_oauth:oauth-client-login", "authentik_sources_oauth:oauth-client-login",
kwargs={"source_slug": self.slug}, kwargs={"source_slug": self.slug},
), ),
icon_path=f"authentik/sources/{self.provider_type}.svg", icon_url=static(f"authentik/sources/{self.provider_type}.svg"),
name=self.name, name=self.name,
) )

View File

@ -169,7 +169,6 @@ class SAMLSource(Source):
url=reverse_lazy( url=reverse_lazy(
"authentik_sources_saml:login", kwargs={"source_slug": self.slug} "authentik_sources_saml:login", kwargs={"source_slug": self.slug}
), ),
icon_path="",
) )
@property @property

View File

@ -34,10 +34,8 @@
{% for source in sources %} {% for source in sources %}
<li class="pf-c-login__main-footer-links-item"> <li class="pf-c-login__main-footer-links-item">
<a href="{{ source.url }}" class="pf-c-login__main-footer-links-item-link"> <a href="{{ source.url }}" class="pf-c-login__main-footer-links-item-link">
{% if source.icon_path %} {% if source.icon_url %}
<img src="{% static source.icon_path %}" style="width:24px;" alt="{{ source.name }}"> <img src="{{ source.icon_url }}" alt="{{ source.name }}">
{% elif source.icon_url %}
<img src="icon_url" alt="{{ source.name }}">
{% else %} {% else %}
<i class="pf-icon pf-icon-arrow" title="{{ source.name }}"></i> <i class="pf-icon pf-icon-arrow" title="{{ source.name }}"></i>
{% endif %} {% endif %}