Commit de4bbe01 authored by chris's avatar chris

Replace registration with allauth. Activate persona.

parent 65a56743
......@@ -12,7 +12,7 @@ Build-Depends: debhelper (>= 9),
python-django-webtest,
python-django-datetime-widget,
python-django-jsonfield,
python-django-registration,
python-django-allauth,
python-django-debug-toolbar
Homepage: https://nuages.domainepublic.net
Vcs-Git: http://git.domainepublic.net/git/nuages.git/
......@@ -20,7 +20,8 @@ Vcs-Browser: http://git.domainepublic.net/?p=nuages.git
Package: nuages
Architecture: all
Depends: python,
Depends: python-all (>= 2.6.6-3~),
${misc:Depends},
python-nuages (= ${source:Version}),
nginx | apache2 | httpd,
gunicorn | libapache2-mod-wsgi,
......@@ -29,9 +30,7 @@ Depends: python,
python-django-webtest,
python-django-datetime-widget,
python-django-jsonfield,
python-django-registration,
python-all (>= 2.6.6-3~),
${misc:Depends}
python-django-allauth
Description: publish online polls
Nuages aims to provide a collaborative meeting poll system.
.
......
......@@ -5,6 +5,9 @@ PROJECT_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'http'
# Make this unique.
SECRET_KEY = '3qm&@6264-=st16)7_xa*ds+31e0mqqs@+*!ud7gzt$tq!b^qn'
......@@ -27,5 +30,5 @@ DATABASES = {
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
STATIC_ROOT = os.path.join(PROJECT_DIR, 'staticroot')
INSTALLED_APPS += (
# 'debug_toolbar',
'debug_toolbar',
)
......@@ -3,6 +3,7 @@
# Django settings for Nuages
import os
import socket
from django.conf import global_settings
DEBUG = False
TEMPLATE_DEBUG = DEBUG
......@@ -116,6 +117,27 @@ TEMPLATE_DIRS = (
# Don't forget to use absolute paths, not relative paths.
)
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
# Required by allauth template tags
"django.core.context_processors.request",
# allauth specific context processors
"allauth.account.context_processors.account",
"allauth.socialaccount.context_processors.socialaccount",
)
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
"django.contrib.auth.backends.ModelBackend",
# `allauth` specific authentication methods, such as login by e-mail
"allauth.account.auth_backends.AuthenticationBackend",
)
ACCOUNT_LOGOUT_ON_GET = True
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
ACCOUNT_USERNAME_MIN_LENGTH = 3
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
......@@ -123,14 +145,16 @@ INSTALLED_APPS = (
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'south',
'registration',
'datetimewidget',
'nuages_templates',
'registration_templates',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.persona',
'datetimewidget',
'meetingpoll',
'django.contrib.admin',
)
try:
......
......@@ -10,22 +10,22 @@ class LoginProcess(WebTest):
userFactory()
def testLoginProcess(self):
login = self.app.get(reverse('auth_login'))
login.form['username'] = 'username_1'
login.form['password'] = 'password_1'
response = login.form.submit().follow()
login = self.app.get(reverse('account_login'))
login.forms[1]['login'] = 'username_1'
login.forms[1]['password'] = 'password_1'
response = login.forms[1].submit().follow()
self.assertEquals('200 OK', response.status)
self.assertContains(
response, 'My account', count=1, status_code=200)
def testLoginWithInvalidCredentials(self):
login = self.app.get(reverse('auth_login'))
login.form['username'] = 'foo'
login.form['password'] = 'bar'
response = login.form.submit()
login = self.app.get(reverse('account_login'))
login.forms[1]['login'] = 'foo'
login.forms[1]['password'] = 'bar'
response = login.forms[1].submit()
self.assertContains(
response,
'Please enter a correct username and password.',
'The username and/or password you specified are not correct',
count=1,
status_code=200
)
......
......@@ -7,10 +7,11 @@ from django.views.generic import TemplateView, ListView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^m/', include('meetingpoll.urls')),
url(r'^accounts/', include('registration.backends.default.urls')),
#url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^accounts/', include('allauth.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^$',
......@@ -29,7 +30,8 @@ urlpatterns = patterns('',
'meetingpoll.views.vote'),
)
urlpatterns += i18n_patterns('',
urlpatterns += i18n_patterns(
'',
url(r'^nuages/$',
TemplateView.as_view(template_name='nuages.html'),
name='documentation_translated'),
......
input[type=text], input[type=password], textarea {
display: block;
/*display: block;*/
/* width: 100%; */
/* height: 34px;*/
margin: 6px 0;
......@@ -22,6 +22,22 @@ input:focus {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}
button {
display:inline-block;
padding:6px 12px;
margin-bottom:0;
font-size:14px;
font-weight:400;
line-height:1.42857143;
text-align:center;
white-space:nowrap;
vertical-align:middle;
cursor:pointer;
user-select:none;
background-image:none;
border:1px solid transparent;
border-radius:4px
}
.navbar-default {
background-color: #fcfcfc;
......
......@@ -36,21 +36,33 @@
<li><a href="{% url 'home' %}" title='{% trans "Homepage" %}'>Nuages</a></li>
{% block menu %}{% endblock %}
{% if user.is_authenticated %}
<li><a href="{% url 'auth_logout' %}">{% trans 'Logout' %}</a></li>
<li><a href="{% url 'account_logout' %}">{% trans 'Logout' %}</a></li>
{% else %}
<li><a href="{% url 'auth_login' %}">{% trans 'Login' %}</a></li>
<li><a href="{% url 'account_login' %}">{% trans 'Login' %}</a></li>
{% endif %}
</ul>
</div>
<div class="box">
{% block main %}{% endblock %}
{% block content %}{% endblock %}
</div>
<br /><br />
<div class="navi box">
{% block footer %}{% endblock %}
<p>
{% trans "This page is available in the following languages" %}:
{% get_available_languages as languages %}
{% for lang_code, lang_name in languages %}
{% language lang_code %}
<a href="{% url 'home_translated' %}">{{ lang_name }}</a>
{% endlanguage %}
{% endfor %}.
</p>
<p>{% trans "Nuages is brought to you by" %} <a href="http://www.domainepublic.net">Domaine Public</a>.<p>
</div>
......
......@@ -48,9 +48,9 @@
<ul>
<li>{% trans "Username" %}: {{user}}</li>
<li><a href="{% url 'profile' %}">{% trans 'Email notifications' %}</a>: {{ user.userprofile.email_notifications }}</li>
<li><a href="{% url 'auth_password_change' %}">{% trans 'Change password' %}</a></li>
<!--<li><a href="/user/email/change/">{% trans 'Change email address' %}</a></li>-->
<li><a href="{% url 'auth_logout' %}">{% trans 'Logout' %}</a></li>
<li><a href="{% url 'account_change_password' %}">{% trans 'Change password' %}</a></li>
<li><a href="{% url 'account_email' %}">{% trans 'Manage email adresses' %}</a>
<li><a href="{% url 'account_logout' %}">{% trans 'Logout' %}</a></li>
</ul>
{% else %}
{% endif %}
......@@ -59,17 +59,3 @@
{% include 'nuages.html' %}
{% endblock %}
{% block footer %}
<p>
{% trans "This page is available in the following languages" %}:
{% get_available_languages as languages %}
{% for lang_code, lang_name in languages %}
{% language lang_code %}
<a href="{% url 'home_translated' %}">{{ lang_name }}</a>
{% endlanguage %}
{% endfor %}.
</p>
{% endblock %}
{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% block main %}
{% if account %}
<p>{% trans "Account successfully activated" %}</p>
<p><a href="{% url 'auth_login' %}">{% trans "Log in" %}</a></p>
{% else %}
<p>{% trans "Account activation failed" %}</p>
{% endif %}
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% load url from future %}
{% block main %}
<h2>Success</h2>
<p class="filet">{% trans 'Your account has been created. You may now login.' %}</p>
<ul>
<li><a href="{% url 'auth_login' %}">Log in</a></li>
</ul>
{% endblock %}
{% load i18n %}
{% load url from future %}
{% trans "Activate account at" %} {{ site.name }}:
http://{{ site.domain }}{% url 'registration_activate' activation_key %}
{% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %}
{% load i18n %}{% trans "Account activation on" %} {{ site.name }}
{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% block main %}
<h1>{% trans "Authentication" %}</h1>
<p class="lead">{% trans "Fill in the form with your credentials." %}</p>
<form method="post" action=".">
{% csrf_token %}
<table>
{{ form }}
<tr><th><label class="hide">&nbsp;</label></th><td><input type="submit" value="{% trans 'Log in' %}" class="btn" /></td></tr>
<input type="hidden" name="next" value="{{ next }}" />
</table>
</form>
<br />
<p>{% trans "Forgot password" %}? <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a>!</p>
<p>{% trans "Not member" %}? <a href="{% url 'registration_register' %}">{% trans "Register" %}</a>!</p>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block main %}
<p>{% trans "Logged out" %}</p>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block main %}
<p>{% trans "Password changed" %}</p>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block main %}
<form method="post" action=".">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}
{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% block main %}
<p>{% trans "Password reset successfully" %}</p>
<p><a href="{% url 'auth_login' %}">{% trans "Log in" %}</a></p>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block main %}
{% if validlink %}
<form method="post" action=".">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% else %}
<p>{% trans "Password reset failed" %}</p>
{% endif %}
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block main %}
<p>{% trans "Email with password reset instructions has been sent." %}</p>
{% endblock %}
{% load i18n %}
{% load url from future %}
{% blocktrans %}Reset password at {{ site_name }}{% endblocktrans %}:
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uidb36=uid, token=token %}
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block main %}
<form method="post" action=".">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block main %}
<p>{% trans "You are now registered. Activation email sent." %}</p>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}Nuages - Create an account{% endblock %}
{% block main %}
<h1>{% trans "Account creation" %}</h1>
<p class="lead">{% trans "Fill in the form to create an account." %}</p>
<form action="" method="post"> {% csrf_token %}
<table>
{{ form }}
<tr><th><label class="hide">&nbsp;</label></th><td><input type="submit" value="Create the account" class="btn"></td></tr>
</table>
</form>
{% endblock %}
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