Merge branch 'aureplop/allauth' into 'master'
Install django-allauth-ens See merge request !1
This commit is contained in:
commit
559f936a3a
4 changed files with 91 additions and 10 deletions
|
@ -41,10 +41,13 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'django.contrib.sites',
|
'django.contrib.sites',
|
||||||
'django.contrib.humanize',
|
'django.contrib.humanize',
|
||||||
|
|
||||||
'django_nyt',
|
'django_nyt',
|
||||||
'mptt',
|
'mptt',
|
||||||
'sekizai',
|
'sekizai',
|
||||||
'sorl.thumbnail',
|
'sorl.thumbnail',
|
||||||
|
'widget_tweaks',
|
||||||
|
|
||||||
'shared', # Do not move, so templates in `shared` can override
|
'shared', # Do not move, so templates in `shared` can override
|
||||||
# thoses in `wiki`
|
# thoses in `wiki`
|
||||||
'wiki',
|
'wiki',
|
||||||
|
@ -52,6 +55,12 @@ INSTALLED_APPS = [
|
||||||
'wiki.plugins.notifications',
|
'wiki.plugins.notifications',
|
||||||
'wiki.plugins.images',
|
'wiki.plugins.images',
|
||||||
'wiki.plugins.macros',
|
'wiki.plugins.macros',
|
||||||
|
|
||||||
|
'allauth_ens',
|
||||||
|
'allauth',
|
||||||
|
'allauth.account',
|
||||||
|
'allauth.socialaccount',
|
||||||
|
'allauth_ens.providers.clipper',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
@ -137,12 +146,35 @@ USE_TZ = True
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
LOGIN_REDIRECT_URL = reverse_lazy('wiki:get', kwargs={'path': ''})
|
|
||||||
|
# Email
|
||||||
|
# https://docs.djangoproject.com/en/1.11/topics/email/
|
||||||
|
|
||||||
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
|
|
||||||
|
|
||||||
|
# Authentication
|
||||||
|
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth
|
||||||
|
# https://django-allauth.readthedocs.io/en/latest/index.html
|
||||||
|
|
||||||
|
AUTHENTICATION_BACKENDS = [
|
||||||
|
'allauth.account.auth_backends.AuthenticationBackend',
|
||||||
|
]
|
||||||
|
|
||||||
|
HOME_URL = reverse_lazy('wiki:root')
|
||||||
|
|
||||||
|
LOGIN_URL = '_profil/login/'
|
||||||
|
LOGIN_REDIRECT_URL = HOME_URL
|
||||||
|
ACCOUNT_LOGOUT_REDIRECT_URL = HOME_URL
|
||||||
|
|
||||||
|
ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS = False
|
||||||
|
ACCOUNT_HOME_URL = HOME_URL
|
||||||
|
ACCOUNT_USER_DISPLAY = lambda u: u.get_full_name() or u.username
|
||||||
|
|
||||||
# WIKI SETTINGS
|
# WIKI SETTINGS
|
||||||
|
|
||||||
# Sign up, login and logout views should be accessible
|
# Use sign up, login, logout, profile settings views of allauth.
|
||||||
WIKI_ACCOUNT_HANDLING = True
|
WIKI_ACCOUNT_HANDLING = False
|
||||||
|
|
||||||
# Signup allowed? If it’s not allowed, logged in superusers
|
# Signup allowed? If it’s not allowed, logged in superusers
|
||||||
# can still access the signup page to create new users.
|
# can still access the signup page to create new users.
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.views.generic import RedirectView
|
|
||||||
from django.urls import reverse_lazy
|
|
||||||
|
|
||||||
|
from allauth_ens.views import capture_login, capture_logout
|
||||||
from wiki.urls import get_pattern as get_wiki_pattern
|
from wiki.urls import get_pattern as get_wiki_pattern
|
||||||
from django_nyt.urls import get_pattern as get_nyt_pattern
|
from django_nyt.urls import get_pattern as get_nyt_pattern
|
||||||
|
|
||||||
redirect_home_view = RedirectView.as_view(url=reverse_lazy('home'))
|
allauth_urls = [
|
||||||
|
# Catch login/logout views of admin site.
|
||||||
|
url(r'^_admin/login/$', capture_login),
|
||||||
|
url(r'^_admin/logout/$', capture_logout),
|
||||||
|
# Allauth urls.
|
||||||
|
url(r'^_profil/', include('allauth.urls')),
|
||||||
|
]
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = allauth_urls + [
|
||||||
url(r'^admin/', admin.site.urls),
|
url(r'^_admin/', admin.site.urls),
|
||||||
url(r'^notifications/', get_nyt_pattern()),
|
url(r'^notifications/', get_nyt_pattern()),
|
||||||
url(r'', get_wiki_pattern()),
|
url(r'', get_wiki_pattern()),
|
||||||
]
|
]
|
||||||
|
|
|
@ -11,4 +11,4 @@ Pillow==4.2.1
|
||||||
six==1.10.0
|
six==1.10.0
|
||||||
sorl-thumbnail==12.3
|
sorl-thumbnail==12.3
|
||||||
wiki==0.2.4
|
wiki==0.2.4
|
||||||
django-allauth-ens==0.0.1.dev0
|
django-allauth-ens==0.0.1.dev1
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "wiki/base_site.html" %}
|
{% extends "wiki/base_site.html" %}
|
||||||
|
{% load i18n staticfiles %}
|
||||||
{% load sekizai_tags %}
|
{% load sekizai_tags %}
|
||||||
{% load staticfiles %}
|
|
||||||
|
|
||||||
{% block wiki_site_title %} - WikiENS{% endblock %}
|
{% block wiki_site_title %} - WikiENS{% endblock %}
|
||||||
|
|
||||||
|
@ -12,6 +12,50 @@
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li class="active"><a href="{% url 'wiki:root' %}">Accueil</a></li>
|
<li class="active"><a href="{% url 'wiki:root' %}">Accueil</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="navbar-right">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||||
|
{% trans "Paramètres de compte" %}
|
||||||
|
<b class="caret"></b>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li>
|
||||||
|
<a href="{% url "account_email" %}">
|
||||||
|
<i class="fa fa-envelope"></i>
|
||||||
|
{% trans "Email" %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{% url "account_change_password" %}">
|
||||||
|
<i class="fa fa-lock"></i>
|
||||||
|
{% trans "Mot de passe" %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{% url "socialaccount_connections" %}" title="Clipper…">
|
||||||
|
<i class="fa fa-sign-in"></i>
|
||||||
|
{% trans "Connexions par tiers" %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></span>
|
||||||
|
<li>
|
||||||
|
<a href="{% url "account_logout" %}">
|
||||||
|
<i class="fa fa-power-off"></i>
|
||||||
|
{% trans "Déconnexion" %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li>
|
||||||
|
<a href="{% url "account_signup" %}">{% trans "Sign Up" %}</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block wiki_footer_logo %}
|
{% block wiki_footer_logo %}
|
||||||
|
|
Loading…
Reference in a new issue