From ee1ab6c41d61b7956f7b838eb00366787618892c Mon Sep 17 00:00:00 2001 From: JohnHerry Date: Wed, 2 Jul 2014 16:21:18 +0800 Subject: [PATCH] Update forms.py fix a bug that when one email used to regist many accounts. clutch can prevent this by regist form validation, but can not prevent site root account to do this on admin page. --- accounts/forms.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/accounts/forms.py b/accounts/forms.py index c254798..c9e54f5 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -99,6 +99,8 @@ def clean_email(self): raise forms.ValidationError(u'E-mail address is already taken.') except User.DoesNotExist: pass + except User.MultipleObjectsReturned: + raise forms.ValidationError(u'E-mail address is already taken.') return email def save(self):