diff --git a/docs/administration/authentication/overview.md b/docs/administration/authentication/overview.md index 2c4506b11..e582f009e 100644 --- a/docs/administration/authentication/overview.md +++ b/docs/administration/authentication/overview.md @@ -49,9 +49,9 @@ to an empty dictionary. This dictionary maps a `social_core` module's name (ie. `REMOTE_AUTH_BACKEND.name`) to a couple of parameters, `(display_name, icon)`. The `display_name` is the name displayed to the user on the login page. The -icon refers to a [Material Design -Icons](https://github.com/google/material-design-icons) icon's name, or `None` -for no icon. +icon may either be the URL of an icon; refer to a [Material Design +Icons](https://github.com/google/material-design-icons) icon's name; or be +`None` for no icon. For instance, the OIDC backend may be customized with ```python diff --git a/netbox/account/views.py b/netbox/account/views.py index feb85fdfe..9b1237765 100644 --- a/netbox/account/views.py +++ b/netbox/account/views.py @@ -44,10 +44,20 @@ class LoginView(View): return super().dispatch(*args, **kwargs) def gen_auth_data(self, name, url, params): - display_name, icon_name = get_auth_backend_display(name) + display_name, icon_source = get_auth_backend_display(name) + + icon_name = None + icon_img = None + if icon_source: + if '://' in icon_source: + icon_img = icon_source + else: + icon_name = icon_source + return { 'display_name': display_name, 'icon_name': icon_name, + 'icon_img': icon_img, 'url': f'{url}?{urlencode(params)}', } diff --git a/netbox/templates/login.html b/netbox/templates/login.html index 1afbd6f29..f8575e4c1 100644 --- a/netbox/templates/login.html +++ b/netbox/templates/login.html @@ -78,7 +78,8 @@ {% for backend in auth_backends %}
- {% if backend.icon_name %}{% endif %} + {% if backend.icon_name %} + {% elif backend.icon_img %}{% endif %} {{ backend.display_name }}