Basic implementation of the registration

* templates/: add an index and html files for the registration
 * settings.py: load registration module
 * urls.py: add registration urls
This commit is contained in:
Jerome Schneider 2010-05-31 17:50:58 +02:00
parent bad962a2b7
commit 191c832353
18 changed files with 186 additions and 2 deletions

View File

@ -92,11 +92,17 @@ INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.admin',
'authentic.idp'
'authentic.idp',
'registration'
)
INTERNAL_IPS = ('127.0.0.1',)
# Registration settings
ACCOUNT_ACTIVATION_DAYS = 2
EMAIL_HOST = 'localhost'
DEFAULT_FROM_EMAIL = 'webmaster@entrouvert.com'
LOGIN_REDIRECT_URL = '/'
INTERNAL_IPS = ('127.0.0.1',)
# local_settings.py can be used to override environment-specific settings
# like database and email that differ between development and production.
@ -108,3 +114,5 @@ except ImportError:
if USE_DEBUG_TOOLBAR:
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INSTALLED_APPS += ('debug_toolbar',)

38
templates/base.html Normal file
View File

@ -0,0 +1,38 @@
{% load i18n %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="/style.css" />
<title>{% block title %}User test{% endblock %}</title>
</head>
<body>
<div id="header">
{% block header %}
<a href="{% url index %}">{% trans "Home" %}</a> |
<a href="/admin/">{% trans "Admin" %}</a> |
{% if user.is_authenticated %}
{% trans "Logged in" %}: {{ user.username }} |
(<a href="{% url auth_logout %}">{% trans "Log out" %}</a> |
<a href="{% url auth_password_change %}">{% trans "Change password" %}</a>)
{% else %}
<a href="{% url auth_login %}">{% trans "Log in" %}</a>
{% endif %}
<hr />
{% endblock %}
</div>
<div id="content">
{% block content %}{% endblock %}
</div>
<div id="footer">
{% block footer %}
<hr />
{% endblock %}
</div>
</body>
</html>

6
templates/index.html Normal file
View File

@ -0,0 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
Index page
{% endblock %}

View File

@ -0,0 +1,18 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
{% 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 %}

View File

@ -0,0 +1,6 @@
{% load i18n %}
{% trans "Activate account at" %} {{ site.name }}:
http://{{ site.domain }}{% url registration_activate activation_key %}
{% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %}

View File

@ -0,0 +1 @@
{% load i18n %}{% trans "Account activation on" %} {{ site.name }}

View File

@ -0,0 +1,14 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<form method="post" action=".">
{{ form.as_p }}
<input type="submit" value="{% trans 'Log in' %}" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
<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 %}

View File

@ -0,0 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<p>{% trans "Logged out" %}</p>
{% endblock %}

View File

@ -0,0 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<p>{% trans "Password changed" %}</p>
{% endblock %}

View File

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<form method="post" action=".">
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}

View File

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<p>{% trans "Password reset successfully" %}</p>
<p><a href="{% url auth_login %}">{% trans "Log in" %}</a></p>
{% endblock %}

View File

@ -0,0 +1,20 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
{% if validlink %}
<form method="post" action=".">
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% else %}
<p>{% trans "Password reset failed" %}</p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<p>{% trans "Email with password reset instructions has been sent." %}</p>
{% endblock %}

View File

@ -0,0 +1,5 @@
{% load i18n %}
{% blocktrans %}Reset password at {{ site_name }}{% endblocktrans %}:
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url auth_password_reset_confirm uidb36=uid, token=token %}
{% endblock %}

View File

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<form method="post" action=".">
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}

View File

@ -0,0 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<p>{% trans "You are now registered. Activation email sent." %}</p>
{% endblock %}

View File

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<form method="post" action=".">
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}

View File

@ -1,5 +1,6 @@
from django.conf.urls.defaults import *
from django.contrib import admin
from django.views.generic.simple import direct_to_template
admin.autodiscover()
urlpatterns = patterns('',
@ -11,4 +12,7 @@ urlpatterns = patterns('',
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
(r'^registration/', include('registration.urls')),
(r'^$', direct_to_template,
{ 'template': 'index.html' }, 'index'),
)