diff options
author | Marcin Kuzminski <marcin@python-works.com> | 2010-11-23 12:58:45 +0100 |
---|---|---|
committer | Marcin Kuzminski <marcin@python-works.com> | 2010-11-23 12:58:45 +0100 |
commit | c28f9b243c8bc55290b8bb5ad4dac5428276a1ea (patch) | |
tree | da4465708ab4419ffe333b14fec3c12c8e0514b4 /rhodecode/model/forms.py | |
parent | 6b8c00589a623a99a57db50ef17a29d32ac9fbfd (diff) |
fixes issue #78, ldap makes user validation caseInsensitive
and fixed validators to check for case insensitive values.
--HG--
branch : beta
Diffstat (limited to 'rhodecode/model/forms.py')
-rw-r--r-- | rhodecode/model/forms.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py index d4980506..cdf6b554 100644 --- a/rhodecode/model/forms.py +++ b/rhodecode/model/forms.py @@ -67,7 +67,7 @@ def ValidUsername(edit, old_data): old_un = UserModel().get(old_data.get('user_id')).username if old_un != value or not edit: - if UserModel().get_by_username(value, cache=False): + if UserModel().get_by_username(value.lower(), cache=False): raise formencode.Invalid(_('This username already exists') , value, state) @@ -244,6 +244,8 @@ class ValidPath(formencode.validators.FancyValidator): def UniqSystemEmail(old_data): class _UniqSystemEmail(formencode.validators.FancyValidator): def to_python(self, value, state): + value = value.lower() + #TODO:write test for MixedCase scenarios if old_data.get('email') != value: sa = meta.Session() try: @@ -260,6 +262,7 @@ def UniqSystemEmail(old_data): class ValidSystemEmail(formencode.validators.FancyValidator): def to_python(self, value, state): + value = value.lower() sa = meta.Session try: user = sa.query(User).filter(User.email == value).scalar() |