Skip to content
Snippets Groups Projects
Commit cb7d01ac authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add first social authentication system (github)

Former-commit-id: 68d5cd12f8261618a02032b14b5e67c91f6b1291
parent b0cf9ee7
No related branches found
No related tags found
No related merge requests found
521ff1feba549fd94abfbcedbfea449190f6f3b2
\ No newline at end of file
fccd9d61cb42d14bf067967988c8ee76a6d781ff
\ No newline at end of file
{% load socialaccount %}
<!DOCTYPE html>
<html lang="en">
<head>
......@@ -60,6 +62,11 @@
<li>
<a href="/admin-session">Admin</a>
</li>
{% if user.is_authenticated %}
<li>Welcome {{ user.username }} !!! <a href="{% url 'logout' %}">logout</a></li>
{% else %}
<li><a href="{% provider_login_url 'github' %}"><i class="fab fa-github" title="Login with github"></i> Login with GitHub</a></li>
{% endif %}
</ul>
</div>
</nav>
......
......@@ -46,7 +46,12 @@ INSTALLED_APPS = [
'ippidb',
'formtools',
'debug_toolbar',
'mod_wsgi.server'
'mod_wsgi.server',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.github',
]
MIDDLEWARE = [
......@@ -140,3 +145,15 @@ GRAPH_MODELS = {
'all_applications': True,
'group_models': True,
}
# myproject/settings.py
AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
"allauth.account.auth_backends.AuthenticationBackend",
)
SITE_ID = 1
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'
......@@ -19,4 +19,6 @@ from django.contrib import admin
urlpatterns = [
url(r'^', include('ippidb.urls')),
url(r'^admin-django/', admin.site.urls),
url(r'^accounts/', include('allauth.urls')),
url(r'^auth/', include('django.contrib.auth.urls')),
]
......@@ -9,3 +9,4 @@ django-formtools
django-debug-toolbar
mod_wsgi
bioblend
django-allauth
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