Commit 50c63c1c authored by Claude Paroz's avatar Claude Paroz

Refs #73 - Add GNOME OpenID login through python-social-auth

Login link limited to the /login page for now.
parent 72311971
Pipeline #38773 canceled with stage
from social_core.backends.open_id import OpenIdAuth
class GNOMEOpenId(OpenIdAuth):
"""GNOME OpenID authentication backend"""
name = 'gnome'
URL = 'https://id.gnome.org'
......@@ -137,6 +137,7 @@ INSTALLED_APPS = [
'django.contrib.humanize',
'django.contrib.messages',
'django.contrib.staticfiles',
'social_django',
'common',
'languages',
'people',
......@@ -146,12 +147,32 @@ INSTALLED_APPS = [
'feeds',
]
AUTHENTICATION_BACKENDS = [
'common.backends.GNOMEOpenId',
'django.contrib.auth.backends.ModelBackend',
]
INTERNAL_IPS=('127.0.0.1',)
SITE_DOMAIN = 'l10n.gnome.org'
LOGIN_REDIRECT_URL = '/'
SOCIAL_AUTH_USER_MODEL = 'people.Person'
SOCIAL_AUTH_PIPELINE = (
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
'social_core.pipeline.social_auth.social_user',
'social_core.pipeline.user.get_username',
# Added (not by default):
'social_core.pipeline.social_auth.associate_by_email',
'social_core.pipeline.user.create_user',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details',
)
# Members of this group can edit all team's details and change team coordinatorship
ADMIN_GROUP = ''
......
......@@ -75,6 +75,7 @@ urlpatterns = [
path('i18n/', include('django.conf.urls.i18n')),
path('admin/', admin.site.urls),
path('rss/', include('feeds.urls')),
path('', include('social_django.urls', namespace='social')),
]
urlpatterns += [
......
......@@ -31,6 +31,11 @@
</div>
</form>
<div style="margin-top: 2em;">
{% url 'social:begin' 'gnome' as link %}
{% blocktrans %}Or <a href="{{ link }}}">login with your GNOME account</a>{% endblocktrans %}
</div>
<script type="text/javascript">
document.getElementById('id_username').focus()
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment