Skip to content

Commit

Permalink
Merge pull request #58 from zalf-rdm/gn_issue_#12167_providing_multip…
Browse files Browse the repository at this point in the history
…le_openid_connect_django_allauth_socialproviders_fails_when_loading_login_page

[Fixes GeoNode#12167] providing multiple openid_connect django.allauth socialproviders fails when loading login page
  • Loading branch information
mwallschlaeger authored Apr 23, 2024
2 parents 1a190bb + b413035 commit 31e9629
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
7 changes: 1 addition & 6 deletions geonode/people/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,7 @@ def get_provider(self, request=None, provider=None):
provider = provider or self.provider_id
provider_class = registry.get_class(provider)
if provider_class is None or provider_class.uses_apps:
# check if first app provider contains client_id, mutiple apps in a single provider
# get seperated into multiple providers, an this function gets called multiple times
# https://github.com/pennersr/django-allauth/blob/main/docs/socialaccount/providers/openid_connect.rst
if not self.list_apps(request)[0].client_id:
raise (ImproperlyConfigured(f"Missing client_id parameter in provider: {provider} configuration"))
app = self.get_app(request, provider=provider, client_id=self.list_apps(request)[0].client_id)
app = self.get_app(request, provider=provider)
if not provider_class:
# In this case, the `provider` argument passed was a
# `provider_id`.
Expand Down
4 changes: 2 additions & 2 deletions geonode/templates/socialaccount/snippets/provider_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
{% for provider in socialaccount_providers %}
{% if provider.id == "openid" %}
{% for brand in provider.get_brands %}
<a class="list-group-item" title="{{brand.name}}" href="{% provider_login_url provider.id openid=brand.openid_url process=process %}">
<a class="list-group-item" title="{{brand.name}}" href="{% provider_login_url provider openid=brand.openid_url process=process %}">
{{brand.name}}
</a>
{% endfor %}
{% endif %}
<div class="form-group">
<a class="btn btn-default btn-block" title="{{provider.name}}" href="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params %}">
<a class="btn btn-default btn-block" title="{{provider.name}}" href="{% provider_login_url provider process=process scope=scope auth_params=auth_params %}">
<i class="fa fa-{{ provider.name|lower }}-square fa-2x" aria-hidden="true"></i>
{% if process == "login" %}
{% trans "Sign in with" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
{% for provider in other_providers %}
{% if provider.id == "openid" %}
{% for brand in provider.get_brands %}
<a class="list-group-item" title="{{brand.name}}" href="{% provider_login_url provider.id openid=brand.openid_url process=process %}">
<a class="list-group-item" title="{{brand.name}}" href="{% provider_login_url provider openid=brand.openid_url process=process %}">
{{brand.name}}
</a>
{% endfor %}
{% endif %}
<div class="form-group">
<a class="btn btn-default btn-block" title="{{provider.name}}" href="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params %}">
<a class="btn btn-default btn-block" title="{{provider.name}}" href="{% provider_login_url provider process=process scope=scope auth_params=auth_params %}">
<i class="fa fa-{{ provider.name|lower }}-square fa-2x" aria-hidden="true"></i>
{% if process == "login" %}
{% trans "Sign in with" %}
Expand Down

0 comments on commit 31e9629

Please sign in to comment.