[svn] A few registration updates

-display an error for nonmatching passwords
-display an error for short passwords
-dont direct people to http://http://sitename....
This commit is contained in:
pjrharley 2009-05-30 16:17:19 +01:00
parent 4735edb9d0
commit 096f74a3f3
3 changed files with 7 additions and 2 deletions

View File

@ -65,6 +65,8 @@ class RegistrationForm(forms.Form):
if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data: if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
if self.cleaned_data['password1'] != self.cleaned_data['password2']: if self.cleaned_data['password1'] != self.cleaned_data['password2']:
raise forms.ValidationError(_(u'You must type the same password each time')) raise forms.ValidationError(_(u'You must type the same password each time'))
if len(self.cleaned_data['password1']) < 6:
raise forms.ValidationError(_(u'Your password must be at least 6 characters'))
return self.cleaned_data return self.cleaned_data
def save(self): def save(self):

View File

@ -2,7 +2,7 @@
<P>Glad you're joining the CUCC EXPO team! Please go to</P> <P>Glad you're joining the CUCC EXPO team! Please go to</P>
<P><a href="http://{{ site }}{% url registration_activate activation_key %}">{{ site }}{% url registration_activate activation_key %}</a></P> <P><a href="{{ site }}{% url registration_activate activation_key %}">{{ site }}{% url registration_activate activation_key %}</a></P>
<P>to activate your account. Do this within {{ expiration_days }} days, or else you'll have to sign up again.</P> <P>to activate your account. Do this within {{ expiration_days }} days, or else you'll have to sign up again.</P>

View File

@ -10,6 +10,9 @@ registration_form.html | {{ block.super }}
{% block content %} {% block content %}
<form action="{% url registration_register %}" method="POST"> <form action="{% url registration_register %}" method="POST">
{% for error in form.non_field_errors %}
<span style="color:red">{{ error }}</span>
{% endfor %}
<table> <table>
<tr> <tr>
<td align="right" valign="top">Username:</td> <td align="right" valign="top">Username:</td>