for user in AstakosUser.objects.filter(email = email):
if user.provider == 'shibboleth':
raise forms.ValidationError(_("This email is already associated with another shibboleth account."))
+ elif not user.is_active:
+ raise forms.ValidationError(_("This email is already associated with an inactive account. \
+ You need to wait to be activated before being able to switch to a shibboleth account."))
super(ShibbolethUserCreationForm, self).clean_email()
return email
if not self.provider:
self.provider = 'local'
report_user_event(self)
- self.full_clean()
+ self.validate_unique_email_isactive()
super(AstakosUser, self).save(**kwargs)
# set group if does not exist
return True
return False
- def validate_unique(self, exclude=None):
+ def validate_unique_email_isactive(self):
"""
Implements a unique_together constraint for email and is_active fields.
"""
- super(AstakosUser, self).validate_unique(exclude)
-
q = AstakosUser.objects.exclude(username = self.username)
q = q.filter(email = self.email)
q = q.filter(is_active = self.is_active)