Commit eb549255 authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Add of allauth backend for authentification



I added and configured the allauth backend for authentification and
registration. At the moment the system doesn't manage oauth2
authentification.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent af357960
......@@ -15,17 +15,17 @@
</li>
{% if not user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" href="{% url 'account:login' %}"><i class="fas fa-sign-in-alt"></i> Login</a>
<a class="nav-link" href="{% url 'account_login' %}"><i class="fas fa-sign-in-alt"></i> Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'account:signup' %}"><i class="fas fa-user-plus"></i> Sign up</a>
<a class="nav-link" href="{% url 'account_signup' %}"><i class="fas fa-user-plus"></i> Sign up</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'main:job_list' %}"><i class="fas fa-database"></i> My jobs</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'account:logout' %}"><i class="fas fa-sign-out-alt"></i> Sign out</a>
<a class="nav-link" href="{% url 'account_logout' %}"><i class="fas fa-sign-out-alt"></i> Sign out</a>
</li>
{% endif %}
</ul>
......
......@@ -53,21 +53,26 @@ WSGI_APPLICATION = 'config.wsgi.application'
DJANGO_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
THIRD_PARTY_APPS = [
'allauth',
'allauth.account',
'allauth.socialaccount',
]
LOCAL_APPS = [
'main',
'accounts',
'main',
]
if "ALLGO_ADDITIONAL_APPS" in os.environ:
INSTALLED_APPS = DJANGO_APPS + LOCAL_APPS + \
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS + \
os.environ['ALLGO_ADDITIONAL_APPS'].split(",")
else:
INSTALLED_APPS = DJANGO_APPS + LOCAL_APPS
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
# MIGRATIONS
......@@ -81,6 +86,8 @@ MIGRATION_MODULES = {
# ------------------------------------------------------------------------------
AUTHENTIFICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
]
LOGIN_REDIRECT_URL = 'main:home'
LOGOUT_REDIRECT_URL = 'main:home'
......@@ -176,6 +183,14 @@ TEMPLATES = [
EMAIL_BACKEND = os.environ.get(
'ALLGO_EMAIL_BACKEND',
default='django.core.mail.backends.smtp.EmailBackend')
DEFAULT_FROM_EMAIL = os.environ.get(
'ALLGO_EMAIL_FROM',
default='no-reply@allgo.inria.fr')
EMAIL_HOST = os.environ.get('ALLGO_EMAIL_HOST', default='smtp.inria.fr')
EMAIL_PORT = os.environ.get('ALLGO_EMAIL_PORT', default=25)
EMAIL_HOST_USER = os.environ.get('ALLGO_EMAIL_USER', default='')
EMAIL_HOST_PASSWORD = os.environ.get('ALLGO_EMAIL_PASSWORD', default='')
EMAIL_USE_TLS = os.environ.get('ALLGO_EMAIL_TLS', default=False)
# ADMIN
......
......@@ -10,7 +10,7 @@ urlpatterns = [
# Allgo stuff here
url(r'', include('main.urls')),
url(r'^account/', include('accounts.urls')),
url(r'^accounts/', include('allauth.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
......
Django==1.11
mysqlclient==1.3.12
django-environ==0.4.4
django-allauth==0.35.0
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