use new password fields in registration form (fixes #24439)
This commit is contained in:
parent
f36b480419
commit
c46822af58
|
@ -19,6 +19,7 @@ from django.template.loader import render_to_string
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
|
|
||||||
|
from authentic2.forms.fields import NewPasswordField, CheckPasswordField
|
||||||
from .. import app_settings, compat, forms, utils, validators, models, middleware, hooks
|
from .. import app_settings, compat, forms, utils, validators, models, middleware, hooks
|
||||||
from authentic2.a2_rbac.models import OrganizationalUnit
|
from authentic2.a2_rbac.models import OrganizationalUnit
|
||||||
|
|
||||||
|
@ -115,10 +116,8 @@ class RegistrationCompletionFormNoPassword(forms.BaseUserForm):
|
||||||
|
|
||||||
|
|
||||||
class RegistrationCompletionForm(RegistrationCompletionFormNoPassword):
|
class RegistrationCompletionForm(RegistrationCompletionFormNoPassword):
|
||||||
password1 = CharField(widget=PasswordInput, label=_("Password"),
|
password1 = NewPasswordField(label=_('Password'))
|
||||||
validators=[validators.validate_password],
|
password2 = CheckPasswordField(label=_("Password (again)"))
|
||||||
help_text=validators.password_help_text())
|
|
||||||
password2 = CharField(widget=PasswordInput, label=_("Password (again)"))
|
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import re
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
@ -585,3 +586,19 @@ def test_registration_redirect_tuple(app, db, settings, mailoutbox, external_red
|
||||||
response = response.form.submit()
|
response = response.form.submit()
|
||||||
assert new_next_url in response.content
|
assert new_next_url in response.content
|
||||||
|
|
||||||
|
|
||||||
|
def test_registration_activate_passwords_not_equal(app, db, settings, mailoutbox):
|
||||||
|
settings.LANGUAGE_CODE = 'en-us'
|
||||||
|
settings.A2_VALIDATE_EMAIL_DOMAIN = can_resolve_dns()
|
||||||
|
settings.A2_EMAIL_IS_UNIQUE = True
|
||||||
|
|
||||||
|
response = app.get(reverse('registration_register'))
|
||||||
|
response.form.set('email', 'testbot@entrouvert.com')
|
||||||
|
response = response.form.submit()
|
||||||
|
response = response.follow()
|
||||||
|
link = get_link_from_mail(mailoutbox[0])
|
||||||
|
response = app.get(link)
|
||||||
|
response.form.set('password1', 'azerty12AZ')
|
||||||
|
response.form.set('password2', 'AAAazerty12AZ')
|
||||||
|
response = response.form.submit()
|
||||||
|
assert "The two password fields didn't match." in response.content
|
||||||
|
|
Loading…
Reference in New Issue