Browse files

make the password field actually validate

  • Loading branch information...
1 parent f0c6700 commit efa28c3ce3de28e791e01360ad70dad196a43ccb @dcolish committed Jan 26, 2011
Showing with 14 additions and 13 deletions.
  1. +9 −7 cockerel/forms/admin.py
  2. +3 −3 cockerel/webapp/admin/admin.py
  3. +2 −3 cockerel/webapp/admin/templates/signup.html
View
16 cockerel/forms/admin.py
@@ -12,17 +12,19 @@ class LoginForm(Form):
class SignupForm(Form):
username = String.using(label='Username',
validators=[Present()])
- password = String.using(label='Password',
- validators=[Present(),
- LengthBetween(5, 25)])
+ password = String.using(
+ label='Password',
+ validators=[
+ Present(),
+ LengthBetween(5, 25),
+ ValuesEqual('.', '../confirmPassword')])
confirmPassword = String.using(label='Confirm Password',
- validators=[Present(),
- ValuesEqual('.', '../password')])
+ validators=[Present()])
email = String.using(label='Email',
validators=[Present(), IsEmail()])
firstname = String.using(label='First Name',
validators=[Present()])
lastname = String.using(label='Last Name',
validators=[Present()])
-
- output_schema = ['username', 'password', 'confirmPassword', 'email', 'firstname', 'lastname']
+ output_schema = ['username', 'password', 'confirmPassword',
+ 'email', 'firstname', 'lastname']
View
6 cockerel/webapp/admin/admin.py
@@ -65,16 +65,16 @@ def signup():
request.form['email'],
request.form['firstname'],
request.form['lastname'])
-
+
db.session.add(user)
db.session.commit()
g.user = user
set_user()
return redirect(url_for('frontend.index'))
else:
gen = Generator()
- return render_template("admin/signup.html",
- form=form,
+ return render_template("admin/signup.html",
+ form=form,
html=gen)
form = SignupForm()
gen = Generator()
View
5 cockerel/webapp/admin/templates/signup.html
@@ -8,10 +8,9 @@
<dd>{{ html.input(form[el]) }}</dd>
{% endif %}
{% for error in form[el].errors %}
- <label>{{ error }}</label><br>
- {% endfor %}
+ <label for="{{form[el].name}}">{{ error }}</label><br>
+ {% endfor %}
{% endfor %}
</dl>
{{ html.input(type='submit', value='join!') }}
</form>
-

0 comments on commit efa28c3

Please sign in to comment.