summaryrefslogtreecommitdiffstats
path: root/askbot/deps
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-05-01 21:09:24 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-05-01 21:09:24 -0400
commitcb01a8d0fc658821a9fcf313007da00a528c2008 (patch)
tree3a70190e37a151db31228de4ad48f1aaaf8373d8 /askbot/deps
parentdb853927d7c6adf8f89e1b0ac7d6c9f9691e0592 (diff)
downloadaskbot-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/deps')
-rw-r--r--askbot/deps/django_authopenid/forms.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/askbot/deps/django_authopenid/forms.py b/askbot/deps/django_authopenid/forms.py
index 332496b5..4ce7242b 100644
--- a/askbot/deps/django_authopenid/forms.py
+++ b/askbot/deps/django_authopenid/forms.py
@@ -363,21 +363,18 @@ class ChangeEmailForm(forms.Form):
def clean_email(self):
""" check if email don't exist """
if 'email' in self.cleaned_data:
- if askbot_settings.EMAIL_UNIQUE == True:
- try:
- user = User.objects.get(email = self.cleaned_data['email'])
- if self.user and self.user == user:
- return self.cleaned_data['email']
- except User.DoesNotExist:
+ try:
+ user = User.objects.get(email = self.cleaned_data['email'])
+ if self.user and self.user == user:
return self.cleaned_data['email']
- except User.MultipleObjectsReturned:
- raise forms.ValidationError(u'There is already more than one \
- account registered with that e-mail address. Please try \
- another.')
- raise forms.ValidationError(u'This email is already registered \
- in our database. Please choose another.')
- else:
+ except User.DoesNotExist:
return self.cleaned_data['email']
+ except User.MultipleObjectsReturned:
+ raise forms.ValidationError(u'There is already more than one \
+ account registered with that e-mail address. Please try \
+ another.')
+ raise forms.ValidationError(u'This email is already registered \
+ in our database. Please choose another.')
class AccountRecoveryForm(forms.Form):
"""with this form user enters email address and
@@ -395,9 +392,9 @@ class AccountRecoveryForm(forms.Form):
if 'email' in self.cleaned_data:
email = self.cleaned_data['email']
try:
- user = User.objects.get(email__iexact=email)
+ user = User.objects.filter(email__iexact=email)[0]
self.cleaned_data['user'] = user
- except User.DoesNotExist:
+ except KeyError:
del self.cleaned_data['email']
message = _('Sorry, we don\'t have this email address in the database')
raise forms.ValidationError(message)