# HG changeset patch # User cavaliet # Date 1405090154 -7200 # Node ID f6742c41d7a3710ef5267689bb2a9a992127b779 # Parent 44af3e5e4114e2a127245aad05a4587d6881096a user form management with django registration diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/settings.py --- a/src/hdabo/settings.py Thu Jul 10 16:17:00 2014 +0200 +++ b/src/hdabo/settings.py Fri Jul 11 16:49:14 2014 +0200 @@ -118,7 +118,8 @@ ) INSTALLED_APPS = ( - 'south', + 'hdabo', + 'south', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', @@ -127,8 +128,8 @@ 'django.contrib.staticfiles', 'django.contrib.admin', 'django_extensions', + 'registration', 'haystack', - 'hdabo', 'hdalab', ) @@ -154,6 +155,8 @@ # User class after migration to django > 1.6.5 AUTH_USER_MODEL = 'hdabo.User' +ACCOUNT_ACTIVATION_DAYS = 7 + from hdabo.config import * #@UnusedWildImport if 'LOGIN_REDIRECT_URL' not in locals(): diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/activate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/activate.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,13 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+ {% if account %} +

{% trans "Account successfully activated" %}

+

{% trans "Log in" %}

+ {% else %} +

{% trans "Account activation failed" %}

+ {% endif %} +
+{% endblock %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/activation_complete.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/activation_complete.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,10 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+

{% trans "Your account is now activated." %}

+

 

+

{% trans "Log in" %}

+
+{% endblock %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/activation_email.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/activation_email.txt Fri Jul 11 16:49:14 2014 +0200 @@ -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 %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/activation_email_subject.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/activation_email_subject.txt Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,1 @@ +{% load i18n %}{% trans "Account activation on" %} {{ site.name }} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/login.html --- a/src/hdabo/templates/registration/login.html Thu Jul 10 16:17:00 2014 +0200 +++ b/src/hdabo/templates/registration/login.html Fri Jul 11 16:49:14 2014 +0200 @@ -1,28 +1,25 @@ {% extends "hdabo_base.html" %} +{% load static %} {% load i18n %} - {% block content %} - {{block.super}} - {% if form.errors %} + +{% block title %}{% trans "Login" %}{% endblock %} + +{% block content %} +
+ {% if form.errors %}

{% trans "Sorry, that's not a valid username or password." %}

- {% endif %} -
-
-
- {% csrf_token %} - -
- - {{form.as_table}} -
-
-
- {% trans "Forget password?" %} -
-
- -
-
-
-
- {% endblock %} - \ No newline at end of file + {% endif %} +
+ {% csrf_token %} + + {{form.as_p}} + +
+

 

+

{% trans "Still not a user ? Create an account" %} +

{% trans "Forgot password ?" %} +

+{% endblock %} + + + diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/password_change_done.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/password_change_done.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,8 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+

{% trans "Password changed" %}

+
+{% endblock %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/password_change_form.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/password_change_form.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,12 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+
+ {% csrf_token %} + {{ form.as_p }} + +
+
+{% endblock %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/password_reset_complete.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/password_reset_complete.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,9 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+

{% trans "Password reset successfully" %}

+

{% trans "Log in" %}

+
+{% endblock %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/password_reset_confirm.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/password_reset_confirm.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,16 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+ {% if validlink %} +
+ {% csrf_token %} + {{ form.as_p }} + +
+ {% else %} +

{% trans "Password reset failed" %}

+ {% endif %} +
+{% endblock %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/password_reset_done.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/password_reset_done.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,8 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+

{% trans "Email with password reset instructions has been sent." %}

+
+{% endblock %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/password_reset_email.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/password_reset_email.html Fri Jul 11 16:49:14 2014 +0200 @@ -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 %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/password_reset_form.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/password_reset_form.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,12 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+
+ {% csrf_token %} + {{ form.as_p }} + +
+
+{% endblock %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/registration_complete.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/registration_complete.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,8 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+

{% trans "You are now registered. Activation email sent." %}

+
+{% endblock %} \ No newline at end of file diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/templates/registration/registration_form.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdabo/templates/registration/registration_form.html Fri Jul 11 16:49:14 2014 +0200 @@ -0,0 +1,12 @@ +{% extends "hdabo_base.html" %} +{% load i18n %} + +{% block content %} +
+
+ {% csrf_token %} + {{ form.as_p }} + +
+
+{% endblock %} diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/urls.py --- a/src/hdabo/urls.py Thu Jul 10 16:17:00 2014 +0200 +++ b/src/hdabo/urls.py Fri Jul 11 16:49:14 2014 +0200 @@ -1,6 +1,6 @@ from django.conf.urls import patterns, include, url from django.contrib import admin -from django.contrib.auth import urls as auth_url +from django.contrib.auth import urls as auth_url, views as auth_views from django.contrib.auth.decorators import login_required from .views import AddOrUpdateFolder, Folders, SearchDatasheet, DeleteFolder from hdalab import urls as hdalab_url @@ -19,6 +19,8 @@ # Uncomment the next line to enable the admin: url(r'^accounts/', include(auth_url)), + url(r'^accounts/password/reset/confirm/(?P[0-9A-Za-z]+)-(?P.+)/$', auth_views.password_reset_confirm, name='password_reset_confirm'), + url(r'^accounts/', include('registration.backends.default.urls')), url(r'^logout/', 'django.contrib.auth.views.logout_then_login'), url(r'^admin/', include(admin.site.urls)), url(r'^search/', include('haystack.urls')), diff -r 44af3e5e4114 -r f6742c41d7a3 src/hdabo/views.py --- a/src/hdabo/views.py Thu Jul 10 16:17:00 2014 +0200 +++ b/src/hdabo/views.py Fri Jul 11 16:49:14 2014 +0200 @@ -15,7 +15,7 @@ from hdabo.utils import OrderedDict, remove_accents, normalize from hdabo.wp_utils import (normalize_tag, query_wikipedia_title, get_or_create_tag, process_tag, reorder_datasheet_tags) from wikitools import wiki -import django.utils.simplejson as json +import json import re from django.views.generic.base import TemplateView, View from haystack.views import SearchView diff -r 44af3e5e4114 -r f6742c41d7a3 virtualenv/res/lib/lib_create_env.py --- a/virtualenv/res/lib/lib_create_env.py Thu Jul 10 16:17:00 2014 +0200 +++ b/virtualenv/res/lib/lib_create_env.py Fri Jul 11 16:49:14 2014 +0200 @@ -19,6 +19,7 @@ 'DISTRIBUTE': {'setup': 'distribute', 'url':'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.24.tar.gz', 'local':"distribute-0.6.24.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'DJANGO': {'setup': 'django', 'url': 'http://www.djangoproject.com/download/1.6.5/tarball/', 'local':"Django-1.6.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/tarball/1.3.7', 'local':"django-extensions-1.3.7.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, + 'REGISTRATION': { 'setup': 'registration', 'url':'https://bitbucket.org/LinnTroll/django-registration-1.5/get/c71d5b8e2735.zip', 'local':"django-registration-1.5-c71d5b8e2735.zip", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'HTTPLIB2': { 'setup': 'python-httplib2', 'url':'http://code.google.com/p/httplib2/downloads/detail?name=httplib2-0.7.4.tar.gz&can=2&q=', 'local':"httplib2-0.7.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.8.4.tar.gz', 'local':"south-0.8.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'PYCRYPTO': {'setup': 'pycrypto', 'url':'https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz', 'local':'pycrypto-2.6.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, diff -r 44af3e5e4114 -r f6742c41d7a3 virtualenv/res/src/django-registration-1.5-c71d5b8e2735.zip Binary file virtualenv/res/src/django-registration-1.5-c71d5b8e2735.zip has changed diff -r 44af3e5e4114 -r f6742c41d7a3 virtualenv/web/res/res_create_env.py --- a/virtualenv/web/res/res_create_env.py Thu Jul 10 16:17:00 2014 +0200 +++ b/virtualenv/web/res/res_create_env.py Fri Jul 11 16:49:14 2014 +0200 @@ -10,6 +10,7 @@ #'PIL', 'DJANGO', 'DJANGO-EXTENSIONS', + 'REGISTRATION', 'SOUTH', 'HTTPLIB2', 'HAYSTACK',