Beispiel #1
0
 def clean_username(self):
     username = self.cleaned_data.get('username')
     if datasender_count_with(username) > 0:
         raise ValidationError(
             _("This email address is already in use. Please supply a different email address"
               ))
     return self.cleaned_data.get('username').lower()
Beispiel #2
0
def _check_uniqueness_of_email_addresses(reporter_details):
    errors = []
    success = True
    for existent_email_address in reporter_details.values():
        count = datasender_count_with(existent_email_address)
        if count > 0:
            success = False
            errors.append("User with email %s already exists" % existent_email_address)
    return success, errors
Beispiel #3
0
    def clean_email(self):
        """
        Validate that the supplied email address is unique for the
        site.

        """
        email = self.cleaned_data.get('email')
        if not email:
            return email

        if datasender_count_with(email) > 0:
            raise forms.ValidationError(
                _("This email address is already in use. Please supply a different email address."))
        return self.cleaned_data['email']
Beispiel #4
0
 def _validate_duplicate_email_address(self, email):
     # registered_emails = self._get_registered_emails()
     matching_email_count = datasender_count_with(email)
     if matching_email_count > 0:
         raise DataObjectAlreadyExists(_("User"), _("email address"), email)
Beispiel #5
0
    def test_should_return_count_of_ds_with_matching_email_and_short_code(
            self):
        count = datasender_count_with(email='*****@*****.**')

        self.assertEqual(count, 1)