from django import forms
from patchwork.models import Patch, State, Bundle, UserProfile
-from registration.forms import RegistrationFormUniqueEmail
-from registration.models import RegistrationProfile
-class RegistrationForm(RegistrationFormUniqueEmail):
+class RegistrationForm(forms.Form):
first_name = forms.CharField(max_length = 30, required = False)
last_name = forms.CharField(max_length = 30, required = False)
- username = forms.CharField(max_length=30, label=u'Username')
+ username = forms.RegexField(regex = r'^\w+$', max_length=30,
+ label=u'Username')
email = forms.EmailField(max_length=100, label=u'Email address')
password = forms.CharField(widget=forms.PasswordInput(),
label='Password')
- password1 = forms.BooleanField(required = False)
- password2 = forms.BooleanField(required = False)
-
- def save(self, profile_callback = None):
- user = RegistrationProfile.objects.create_inactive_user( \
- username = self.cleaned_data['username'],
- password = self.cleaned_data['password'],
- email = self.cleaned_data['email'],
- profile_callback = profile_callback)
- user.first_name = self.cleaned_data.get('first_name', '')
- user.last_name = self.cleaned_data.get('last_name', '')
- user.save()
-
- # saving the userprofile causes the firstname/lastname to propagate
- # to the person objects.
- user.get_profile().save()
-
- return user
+
+ def clean_username(self):
+ value = self.cleaned_data['username']
+ try:
+ user = User.objects.get(username__iexact = value)
+ except User.DoesNotExist:
+ return self.cleaned_data['username']
+ raise forms.ValidationError('This username is already taken. ' + \
+ 'Please choose another.')
+
+ def clean_email(self):
+ value = self.cleaned_data['email']
+ try:
+ user = User.objects.get(email__iexact = value)
+ except User.DoesNotExist:
+ return self.cleaned_data['email']
+ raise forms.ValidationError('This email address is already in use ' + \
+ 'for the account "%s".\n' % user.username)
def clean(self):
return self.cleaned_data
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
+from django.conf import settings
from patchwork.parser import hash_patch
import re
ordering = ['order']
class EmailConfirmation(models.Model):
- validity = datetime.timedelta(days = 30)
+ validity = datetime.timedelta(days = settings.CONFIRMATION_VALIDITY_DAYS)
type = models.CharField(max_length = 20, choices = [
('userperson', 'User-Person association'),
+ ('registration', 'Registration'),
])
email = models.CharField(max_length = 200)
user = models.ForeignKey(User, null = True)
from patchwork.tests.updates import *
from patchwork.tests.filters import *
from patchwork.tests.confirm import *
+from patchwork.tests.registration import *
+from patchwork.tests.user import *
--- /dev/null
+# Patchwork - automated patch tracking system
+# Copyright (C) 2010 Jeremy Kerr <jk@ozlabs.org>
+#
+# This file is part of the Patchwork package.
+#
+# Patchwork is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Patchwork is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Patchwork; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import unittest
+from django.test import TestCase
+from django.test.client import Client
+from django.core import mail
+from django.core.urlresolvers import reverse
+from django.contrib.auth.models import User
+from patchwork.models import EmailConfirmation, Person
+from patchwork.tests.utils import create_user
+
+def _confirmation_url(conf):
+ return reverse('patchwork.views.confirm', kwargs = {'key': conf.key})
+
+class TestUser(object):
+ firstname = 'Test'
+ lastname = 'User'
+ username = 'testuser'
+ email = 'test@example.com'
+ password = 'foobar'
+
+class RegistrationTest(TestCase):
+ def setUp(self):
+ self.user = TestUser()
+ self.client = Client()
+ self.default_data = {'username': self.user.username,
+ 'first_name': self.user.firstname,
+ 'last_name': self.user.lastname,
+ 'email': self.user.email,
+ 'password': self.user.password}
+ self.required_error = 'This field is required.'
+ self.invalid_error = 'Enter a valid value.'
+
+ def testRegistrationForm(self):
+ response = self.client.get('/register/')
+ self.assertEquals(response.status_code, 200)
+ self.assertTemplateUsed(response, 'patchwork/registration_form.html')
+
+ def testBlankFields(self):
+ for field in ['username', 'email', 'password']:
+ data = self.default_data.copy()
+ del data[field]
+ response = self.client.post('/register/', data)
+ self.assertEquals(response.status_code, 200)
+ self.assertFormError(response, 'form', field, self.required_error)
+
+ def testInvalidUsername(self):
+ data = self.default_data.copy()
+ data['username'] = 'invalid user'
+ response = self.client.post('/register/', data)
+ self.assertEquals(response.status_code, 200)
+ self.assertFormError(response, 'form', 'username', self.invalid_error)
+
+ def testExistingUsername(self):
+ user = create_user()
+ data = self.default_data.copy()
+ data['username'] = user.username
+ response = self.client.post('/register/', data)
+ self.assertEquals(response.status_code, 200)
+ self.assertFormError(response, 'form', 'username',
+ 'This username is already taken. Please choose another.')
+
+ def testExistingEmail(self):
+ user = create_user()
+ data = self.default_data.copy()
+ data['email'] = user.email
+ response = self.client.post('/register/', data)
+ self.assertEquals(response.status_code, 200)
+ self.assertFormError(response, 'form', 'email',
+ 'This email address is already in use ' + \
+ 'for the account "%s".\n' % user.username)
+
+ def testValidRegistration(self):
+ response = self.client.post('/register/', self.default_data)
+ self.assertEquals(response.status_code, 200)
+ self.assertContains(response, 'confirmation email has been sent')
+
+ # check for presence of an inactive user object
+ users = User.objects.filter(username = self.user.username)
+ self.assertEquals(users.count(), 1)
+ user = users[0]
+ self.assertEquals(user.username, self.user.username)
+ self.assertEquals(user.email, self.user.email)
+ self.assertEquals(user.is_active, False)
+
+ # check for confirmation object
+ confs = EmailConfirmation.objects.filter(user = user,
+ type = 'registration')
+ self.assertEquals(len(confs), 1)
+ conf = confs[0]
+ self.assertEquals(conf.email, self.user.email)
+
+ # check for a sent mail
+ self.assertEquals(len(mail.outbox), 1)
+ msg = mail.outbox[0]
+ self.assertEquals(msg.subject, 'Patchwork account confirmation')
+ self.assertTrue(self.user.email in msg.to)
+ self.assertTrue(_confirmation_url(conf) in msg.body)
+
+ # ...and that the URL is valid
+ response = self.client.get(_confirmation_url(conf))
+ self.assertEquals(response.status_code, 200)
+
+class RegistrationConfirmationTest(TestCase):
+
+ def setUp(self):
+ self.user = TestUser()
+ self.default_data = {'username': self.user.username,
+ 'first_name': self.user.firstname,
+ 'last_name': self.user.lastname,
+ 'email': self.user.email,
+ 'password': self.user.password}
+
+ def testRegistrationConfirmation(self):
+ self.assertEqual(EmailConfirmation.objects.count(), 0)
+ response = self.client.post('/register/', self.default_data)
+ self.assertEquals(response.status_code, 200)
+ self.assertContains(response, 'confirmation email has been sent')
+
+ self.assertEqual(EmailConfirmation.objects.count(), 1)
+ conf = EmailConfirmation.objects.filter()[0]
+ self.assertFalse(conf.user.is_active)
+ self.assertTrue(conf.active)
+
+ response = self.client.get(_confirmation_url(conf))
+ self.assertEquals(response.status_code, 200)
+ self.assertTemplateUsed(response, 'patchwork/registration-confirm.html')
+
+ conf = EmailConfirmation.objects.get(pk = conf.pk)
+ self.assertTrue(conf.user.is_active)
+ self.assertFalse(conf.active)
+
+
from django.test.client import Client
from django.core import mail
from django.core.urlresolvers import reverse
+from django.conf import settings
from django.contrib.auth.models import User
from patchwork.models import EmailConfirmation, Person
-from patchwork.utils import userprofile_register_callback
def _confirmation_url(conf):
return reverse('patchwork.views.confirm', kwargs = {'key': conf.key})
self.password = User.objects.make_random_password()
self.user = User.objects.create_user(self.username,
self.email, self.password)
- userprofile_register_callback(self.user)
class UserPersonRequestTest(TestCase):
def setUp(self):
# need to reload the confirmation to check this.
conf = EmailConfirmation.objects.get(pk = self.conf.pk)
self.assertEquals(conf.active, False)
+
+class UserLoginRedirectTest(TestCase):
+
+ def testUserLoginRedirect(self):
+ url = '/user/'
+ response = self.client.get(url)
+ self.assertRedirects(response, settings.LOGIN_URL + '?next=' + url)
+
_user_idx = 1
def create_user():
global _user_idx
- userid = 'test-%d' % _user_idx
+ userid = 'test%d' % _user_idx
email = '%s@example.com' % userid
_user_idx += 1
from django.conf.urls.defaults import *
from django.conf import settings
+from django.contrib.auth import views as auth_views
urlpatterns = patterns('',
# Example:
(r'^user/link/$', 'patchwork.views.user.link'),
(r'^user/unlink/(?P<person_id>[^/]+)/$', 'patchwork.views.user.unlink'),
+ # password change
+ url(r'^user/password-change/$', auth_views.password_change,
+ name='auth_password_change'),
+ url(r'^user/password-change/done/$', auth_views.password_change_done,
+ name='auth_password_change_done'),
+
+ # login/logout
+ url(r'^user/login/$', auth_views.login,
+ {'template_name': 'patchwork/login.html'},
+ name = 'auth_login'),
+ url(r'^user/logout/$', auth_views.logout,
+ {'template_name': 'patchwork/logout.html'},
+ name = 'auth_logout'),
+
+ # registration
+ (r'^register/', 'patchwork.views.user.register'),
+
# public view for bundles
(r'^bundle/(?P<username>[^/]*)/(?P<bundlename>[^/]*)/$',
'patchwork.views.bundle.public'),
import patchwork.views.user
views = {
'userperson': patchwork.views.user.link_confirm,
+ 'registration': patchwork.views.user.register_confirm,
}
conf = get_object_or_404(EmailConfirmation, key = key)
from django.contrib.auth.decorators import login_required
from patchwork.requestcontext import PatchworkRequestContext
from django.shortcuts import render_to_response, get_object_or_404
+from django.contrib import auth
+from django.contrib.sites.models import Site
from django.http import HttpResponseRedirect
from patchwork.models import Project, Bundle, Person, EmailConfirmation, State
-from patchwork.forms import UserProfileForm, UserPersonLinkForm
+from patchwork.forms import UserProfileForm, UserPersonLinkForm, \
+ RegistrationForm
from patchwork.filters import DelegateFilter
from patchwork.views import generic_list
from django.template.loader import render_to_string
from django.core.mail import send_mail
import django.core.urlresolvers
+def register(request):
+ context = PatchworkRequestContext(request)
+ if request.method == 'POST':
+ form = RegistrationForm(request.POST)
+ if form.is_valid():
+ data = form.cleaned_data
+ # create inactive user
+ user = auth.models.User.objects.create_user(data['username'],
+ data['email'],
+ data['password'])
+ user.is_active = False;
+ user.first_name = data.get('first_name', '')
+ user.last_name = data.get('last_name', '')
+ user.save()
+
+ # create confirmation
+ conf = EmailConfirmation(type = 'registration', user = user,
+ email = user.email)
+ conf.save()
+
+ # send email
+ mail_ctx = {'site': Site.objects.get_current(),
+ 'confirmation': conf}
+
+ subject = render_to_string('patchwork/activation_email_subject.txt',
+ mail_ctx).replace('\n', ' ').strip()
+
+ message = render_to_string('patchwork/activation_email.txt',
+ mail_ctx)
+
+ send_mail(subject, message, settings.DEFAULT_FROM_EMAIL,
+ [conf.email])
+
+ # setting 'confirmation' in the template indicates success
+ context['confirmation'] = conf
+
+ else:
+ form = RegistrationForm()
+
+ return render_to_response('patchwork/registration_form.html',
+ { 'form': form },
+ context_instance=context)
+
+def register_confirm(request, conf):
+ conf.user.is_active = True
+ conf.user.save()
+ conf.deactivate()
+ return render_to_response('patchwork/registration-confirm.html')
+
@login_required
def profile(request):
context = PatchworkRequestContext(request)
ROOT_URLCONF = 'apps.urls'
-LOGIN_URL = '/accounts/login'
+LOGIN_URL = '/user/login/'
LOGIN_REDIRECT_URL = '/user/'
# If you change the ROOT_DIR setting in your local_settings.py, you'll need to
'django.contrib.sites',
'django.contrib.admin',
'patchwork',
- 'registration',
)
DEFAULT_PATCHES_PER_PAGE = 100
DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@patchwork.example.com>'
-ACCOUNT_ACTIVATION_DAYS = 7
+CONFIRMATION_VALIDITY_DAYS = 7
# Set to True to enable the Patchwork XML-RPC interface
ENABLE_XMLRPC = False
from django.conf import settings
from django.contrib import admin
-from registration.views import register
-from patchwork.forms import RegistrationForm
-
admin.autodiscover()
htdocs = os.path.join(settings.ROOT_DIR, 'htdocs')
# Example:
(r'^', include('patchwork.urls')),
- # override the default registration form
- url(r'^accounts/register/$',
- register, {'form_class': RegistrationForm},
- name='registration_register'),
-
- (r'^accounts/', include('registration.urls')),
-
# Uncomment this for admin:
(r'^admin/', include(admin.site.urls)),
cd ../python
ln -s ../packages/django/django ./django
- We also use the django-registration infrastructure from
- http://bitbucket.org/ubernostrum/django-registration/. Your distro
- may provide the django-registration python module (in Ubuntu/Debian it's
- called 'python-django-registration'). If not, download the module
- and symlink it to lib/python/ :
-
- cd lib/packages/
- hg clone http://bitbucket.org/ubernostrum/django-registration/
- cd ../python
- ln -s ../packages/django-registration/registration ./registration
-
We also use some Javascript libraries:
cd lib/packages
GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_bundle TO 'www-data'@localhost;
GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_bundle_patches TO 'www-data'@localhost;
GRANT SELECT, UPDATE, INSERT, DELETE ON patchwork_patch TO 'www-data'@localhost;
-GRANT SELECT, UPDATE, INSERT, DELETE ON registration_registrationprofile TO 'www-data'@localhost;
-- allow the mail user (in this case, 'nobody') to add patches
GRANT INSERT, SELECT ON patchwork_patch TO 'nobody'@localhost;
patchwork_project,
patchwork_bundle,
patchwork_bundlepatch,
- patchwork_patch,
- registration_registrationprofile
+ patchwork_patch
TO "www-data";
GRANT SELECT, UPDATE ON
auth_group_id_seq,
patchwork_state_id_seq,
patchwork_emailconfirmation_id_seq,
patchwork_userprofile_id_seq,
- patchwork_userprofile_maintainer_projects_id_seq,
- registration_registrationprofile_id_seq
+ patchwork_userprofile_maintainer_projects_id_seq
TO "www-data";
-- allow the mail user (in this case, 'nobody') to add patches
--- /dev/null
+BEGIN;
+
+DELETE FROM registration_registrationprofile;
+
+-- unlink users who have contributed
+
+UPDATE patchwork_person SET user_id = NULL
+ WHERE user_id IN (SELECT id FROM auth_user WHERE is_active = False)
+ AND id IN (SELECT DISTINCT submitter_id FROM patchwork_comment);
+
+-- remove persons who only have a user linkage
+
+DELETE FROM patchwork_person WHERE user_id IN
+ (SELECT id FROM auth_user WHERE is_active = False);
+
+-- delete profiles
+
+DELETE FROM patchwork_userprofile WHERE user_id IN
+ (SELECT id FROM auth_user WHERE is_active = False);
+
+-- delete inactive users
+
+DELETE FROM auth_user WHERE is_active = False;
+
+DROP TABLE registration_registrationprofile;
+
+COMMIT;
{% else %}
<a href="{% url auth_login %}">login</a>
<br/>
- <a href="{% url registration_register %}">register</a>
+ <a href="{% url patchwork.views.user.register %}">register</a>
{% endif %}
</div>
<div style="clear: both;"></div>
--- /dev/null
+Hi,
+
+This email is to confirm your account on the patchwork patch-tracking
+system. You can activate your account by visiting the url:
+
+ http://{{site.domain}}{% url patchwork.views.confirm key=confirmation.key %}
+
+If you didn't request a user account on patchwork, then you can ignore
+this mail.
+
+Happy patchworking.
--- /dev/null
+Patchwork account confirmation
<p>Patchwork is built on the <a href="http://djangoproject.com/">django</a>
web framework.</p>
-<p>Patchwork includes the <a
-href="http://code.google.com/p/django-registration/">django-registration</a>
-application.</p>
-
<p>Icons from the <a href="http://sweetie.sublink.ca/">Sweetie</a> icon set.</a>
{% endblock %}
--- /dev/null
+{% extends "base.html" %}
+
+{% block title %}Login{% endblock %}
+{% block heading %}Login{% endblock %}
+
+
+{% block body %}
+<form method="post">
+{% csrf_token %}
+<table class="form loginform">
+ <tr>
+ <th colspan="2" class="headerrow">login</th>
+ </tr>
+ {% if error %}
+ <tr>
+ <td colspan="2">{{ error }}</td>
+ </tr>
+ {% endif %}
+ {{ form }}
+ <tr>
+ <td colspan="2" class="submitrow">
+ <input type="submit" value="Login"/>
+ </td>
+ </tr>
+</table>
+</form>
+{% endblock %}
--- /dev/null
+{% extends "base.html" %}
+
+{% block title %}Logout{% endblock %}
+{% block heading %}Logout{% endblock %}
+
+{% block body %}
+<p>Logged out</p>
+{% endblock %}
--- /dev/null
+{% extends "base.html" %}
+
+{% block title %}Registration{% endblock %}
+{% block heading %}Registration{% endblock %}
+
+{% block body %}
+<p>Registraton confirmed!</p>
+
+<p>Your patchwork registration is complete. Head over to your <a
+ href="{% url patchwork.views.user.profile %}">profile</a> to start using
+patchwork's extra features.</p>
+
+{% endblock %}
--- /dev/null
+{% extends "base.html" %}
+
+{% block title %}Registration{% endblock %}
+{% block heading %}Registration{% endblock %}
+
+
+{% block body %}
+
+{% if confirmation and not error %}
+ <p>Registration successful!</p>
+ <p>A confirmation email has been sent to {{ confirmation.email }}. You'll
+ need to visit the link provided in that email to confirm your
+ registration.</p>
+</p>
+{% else %}
+<p>By creating a patchwork account, you can:<p>
+<ul>
+ <li>create "bundles" of patches</li>
+ <li>update the state of your own patches</li>
+</ul>
+<form method="post">
+{% csrf_token %}
+<table class="form registerform">
+ <tr>
+ <th colspan="2" class="headerrow">register</th>
+ </tr>
+ {% if error %}
+ <tr>
+ <td colspan="2">{{ error }}</td>
+ </tr>
+ {% endif %}
+
+ <tr>
+ <td>{{ form.first_name.label_tag }}</td>
+ <td>
+{% if form.first_name.errors %}
+ {{ form.first_name.errors }}
+{% endif %}
+ {{ form.first_name }}
+{% if form.first_name.help_text %}
+ <div class="help_text"/>{{ form.first_name.help_text }}</div>
+{% endif %}
+ </td>
+ </tr>
+
+ <tr>
+ <td>{{ form.last_name.label_tag }}</td>
+ <td>
+{% if form.last_name.errors %}
+ {{ form.last_name.errors }}
+{% endif %}
+ {{ form.last_name }}
+{% if form.last_name.help_text %}
+ <div class="help_text"/>{{ form.last_name.help_text }}</div>
+{% endif %}
+ </td>
+ </tr>
+
+ <tr>
+ <td></td>
+ <td class="form-help">
+ Your name is used to identify you on the site
+ </td>
+ </tr>
+
+ <tr>
+ <td>{{ form.email.label_tag }}</td>
+ <td>
+{% if form.email.errors %}
+ {{ form.email.errors }}
+{% endif %}
+ {{ form.email }}
+{% if form.email.help_text %}
+ <div class="help_text"/>{{ form.email.help_text }}</div>
+{% endif %}
+ </td>
+ </tr>
+
+ <tr>
+ <td></td>
+ <td class="form-help">
+ Patchwork will send a confirmation email to this address
+ </td>
+ </tr>
+
+ <tr>
+ <td>{{ form.username.label_tag }}</td>
+ <td>
+{% if form.username.errors %}
+ {{ form.username.errors }}
+{% endif %}
+ {{ form.username }}
+{% if form.username.help_text %}
+ <div class="help_text"/>{{ form.username.help_text }}</div>
+{% endif %}
+ </td>
+ </tr>
+
+ <tr>
+ <td>{{ form.password.label_tag }}</td>
+ <td>
+{% if form.password.errors %}
+ {{ form.password.errors }}
+{% endif %}
+ {{ form.password }}
+{% if form.password.help_text %}
+ <div class="help_text"/>{{ form.password.help_text }}</div>
+{% endif %}
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" class="submitrow">
+ <input type="submit" value="Register"/>
+ </td>
+ </tr>
+</table>
+</form>
+{% endif %}
+
+{% endblock %}
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}Registration{% endblock %}
-{% block heading %}Registration{% endblock %}
-
-{% block body %}
-<p>Registraton confirmed!</p>
-
-<p>Your patchwork registration is complete. Head over to your <a
- href="{% url patchwork.views.user.profile %}">profile</a> to start using
-patchwork's extra features.</p>
-
-{% endblock %}
+++ /dev/null
-Hi,
-
-This email is to confirm your account on the patchwork patch-tracking
-system. You can activate your account by visiting the url:
-
- http://{{site.domain}}{% url registration_activate activation_key=activation_key %}
-
-If you didn't request a user account on patchwork, then you can ignore
-this mail.
-
-Happy patchworking.
+++ /dev/null
-Patchwork account confirmation
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}Login{% endblock %}
-{% block heading %}Login{% endblock %}
-
-
-{% block body %}
-<form method="post">
-{% csrf_token %}
-<table class="form loginform">
- <tr>
- <th colspan="2" class="headerrow">login</th>
- </tr>
- {% if error %}
- <tr>
- <td colspan="2">{{ error }}</td>
- </tr>
- {% endif %}
- {{ form }}
- <tr>
- <td colspan="2" class="submitrow">
- <input type="submit" value="Login"/>
- </td>
- </tr>
-</table>
-</form>
-{% endblock %}
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}Logout{% endblock %}
-{% block heading %}Logout{% endblock %}
-
-{% block body %}
-<p>Logged out</p>
-{% endblock %}
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}Registration{% endblock %}
-{% block heading %}Registration{% endblock %}
-
-{% block body %}
-
- <p>Registration successful!</p>
- <p>A confirmation email has been sent to your email address. You'll
- need to visit the link provided in that email to activate your
- patchwork account.</p>
-
-{% endblock %}
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}Registration{% endblock %}
-{% block heading %}Registration{% endblock %}
-
-
-{% block body %}
-
-{% if request and not error %}
- <p>Registration successful!</p>
- <p>A confirmation email has been sent to {{ request.email }}. You'll
- need to visit the link provided in that email to confirm your
- registration.</p>
- <pre>{{email}}</pre>
-</p>
-{% else %}
-<p>By creating a patchwork account, you can:<p>
-<ul>
- <li>create "bundles" of patches</li>
- <li>update the state of your own patches</li>
-</ul>
-<form method="post">
-{% csrf_token %}
-<table class="form registerform">
- <tr>
- <th colspan="2" class="headerrow">register</th>
- </tr>
- {% if error %}
- <tr>
- <td colspan="2">{{ error }}</td>
- </tr>
- {% endif %}
-
- <tr>
- <td>{{ form.first_name.label_tag }}</td>
- <td>
-{% if form.first_name.errors %}
- {{ form.first_name.errors }}
-{% endif %}
- {{ form.first_name }}
-{% if form.first_name.help_text %}
- <div class="help_text"/>{{ form.first_name.help_text }}</div>
-{% endif %}
- </td>
- </tr>
-
- <tr>
- <td>{{ form.last_name.label_tag }}</td>
- <td>
-{% if form.last_name.errors %}
- {{ form.last_name.errors }}
-{% endif %}
- {{ form.last_name }}
-{% if form.last_name.help_text %}
- <div class="help_text"/>{{ form.last_name.help_text }}</div>
-{% endif %}
- </td>
- </tr>
-
- <tr>
- <td></td>
- <td class="form-help">
- Your name is used to identify you on the site
- </td>
- </tr>
-
- <tr>
- <td>{{ form.email.label_tag }}</td>
- <td>
-{% if form.email.errors %}
- {{ form.email.errors }}
-{% endif %}
- {{ form.email }}
-{% if form.email.help_text %}
- <div class="help_text"/>{{ form.email.help_text }}</div>
-{% endif %}
- </td>
- </tr>
-
- <tr>
- <td></td>
- <td class="form-help">
- Patchwork will send a confirmation email to this address
- </td>
- </tr>
-
- <tr>
- <td>{{ form.username.label_tag }}</td>
- <td>
-{% if form.username.errors %}
- {{ form.username.errors }}
-{% endif %}
- {{ form.username }}
-{% if form.username.help_text %}
- <div class="help_text"/>{{ form.username.help_text }}</div>
-{% endif %}
- </td>
- </tr>
-
- <tr>
- <td>{{ form.password.label_tag }}</td>
- <td>
-{% if form.password.errors %}
- {{ form.password.errors }}
-{% endif %}
- {{ form.password }}
-{% if form.password.help_text %}
- <div class="help_text"/>{{ form.password.help_text }}</div>
-{% endif %}
- </td>
- </tr>
-
- <tr>
- <td colspan="2" class="submitrow">
- <input type="submit" value="Register"/>
- </td>
- </tr>
-</table>
-</form>
-{% endif %}
-
-{% endblock %}