diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-05-01 21:09:24 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-05-01 21:09:24 -0400 |
commit | cb01a8d0fc658821a9fcf313007da00a528c2008 (patch) | |
tree | 3a70190e37a151db31228de4ad48f1aaaf8373d8 /askbot/forms.py | |
parent | db853927d7c6adf8f89e1b0ac7d6c9f9691e0592 (diff) | |
download | askbot-cb01a8d0fc658821a9fcf313007da00a528c2008.tar.gz askbot-cb01a8d0fc658821a9fcf313007da00a528c2008.tar.bz2 askbot-cb01a8d0fc658821a9fcf313007da00a528c2008.zip |
removed possibility to have >1 account with the same email address
Diffstat (limited to 'askbot/forms.py')
-rw-r--r-- | askbot/forms.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/askbot/forms.py b/askbot/forms.py index 39a390be..1ef8cefa 100644 --- a/askbot/forms.py +++ b/askbot/forms.py @@ -1449,21 +1449,20 @@ class EditUserForm(forms.Form): """For security reason one unique email in database""" if self.user.email != self.cleaned_data['email']: #todo dry it, there is a similar thing in openidauth - if askbot_settings.EMAIL_UNIQUE is True: - if 'email' in self.cleaned_data: - try: - User.objects.get(email=self.cleaned_data['email']) - except User.DoesNotExist: - return self.cleaned_data['email'] - except User.MultipleObjectsReturned: - raise forms.ValidationError(_( - 'this email has already been registered, ' - 'please use another one') - ) + if 'email' in self.cleaned_data: + try: + User.objects.get(email=self.cleaned_data['email']) + except User.DoesNotExist: + return self.cleaned_data['email'] + except User.MultipleObjectsReturned: raise forms.ValidationError(_( 'this email has already been registered, ' 'please use another one') ) + raise forms.ValidationError(_( + 'this email has already been registered, ' + 'please use another one') + ) return self.cleaned_data['email'] |