Revision 789a5951

b/snf-astakos-app/astakos/im/api/__init__.py
112 112
    if not email:
113 113
        raise BadRequest('Email missing')
114 114
    try:
115
        user = AstakosUser.objects.get(email=email)
115
        user = AstakosUser.objects.get(email__iexact=email)
116 116
    except AstakosUser.DoesNotExist:
117 117
        raise ItemNotFound('Invalid email')
118 118

  
b/snf-astakos-app/astakos/im/auth_backends.py
48 48
    """
49 49
    def authenticate(self, email=None, auth_token=None):
50 50
        try:
51
            user = AstakosUser.objects.get(email=email, is_active=True)
51
            user = AstakosUser.objects.get(email__iexact=email, is_active=True)
52 52
            if user.auth_token == auth_token:
53 53
                return user
54 54
        except AstakosUser.DoesNotExist:
......
74 74
    def authenticate(self, username=None, password=None):
75 75
        #If username is an email address, then try to pull it up
76 76
        if email_re.search(username):
77
            users = AstakosUser.objects.filter(email=username)
77
            users = AstakosUser.objects.filter(email__iexact=username)
78 78
            if not users:
79 79
                return None
80 80
            for user in users:
b/snf-astakos-app/astakos/im/forms.py
293 293
        if self.instance:
294 294
            if self.instance.email == email:
295 295
                raise forms.ValidationError(_("This is your current email."))
296
        for user in AstakosUser.objects.filter(email=email):
296
        for user in AstakosUser.objects.filter(email__iexact=email):
297 297
            if user.provider == 'shibboleth':
298 298
                raise forms.ValidationError(_(
299 299
                        "This email is already associated with another \
......
452 452
    def clean_email(self):
453 453
        email = super(ExtendedPasswordResetForm, self).clean_email()
454 454
        try:
455
            user = AstakosUser.objects.get(email=email, is_active=True)
455
            user = AstakosUser.objects.get(email__iexact=email, is_active=True)
456 456
            if not user.has_usable_password():
457 457
                raise forms.ValidationError(_(astakos_messages.UNUSABLE_PASSWORD))
458 458
        except AstakosUser.DoesNotExist:
b/snf-astakos-app/astakos/im/management/commands/_common.py
47 47
        if email_or_id.isdigit():
48 48
            return AstakosUser.objects.get(id=int(email_or_id))
49 49
        else:
50
            return AstakosUser.objects.get(email=email_or_id, **kwargs)
50
            return AstakosUser.objects.get(email__iexact=email_or_id, **kwargs)
51 51
    except AstakosUser.DoesNotExist, AstakosUser.MultipleObjectsReturned:
52 52
        return None
53 53

  
b/snf-astakos-app/astakos/im/management/commands/user-details.py
50 50
        if email_or_id.isdigit():
51 51
            users = AstakosUser.objects.filter(id=int(email_or_id))
52 52
        else:
53
            users = AstakosUser.objects.filter(email=email_or_id)
53
            users = AstakosUser.objects.filter(email__iexact=email_or_id)
54 54
        if users.count() == 0:
55 55
            field = 'id' if email_or_id.isdigit() else 'email'
56 56
            msg = "Unknown user with %s '%s'" % (field, email_or_id)
b/snf-astakos-app/astakos/im/models.py
525 525

  
526 526
    def conflicting_email(self):
527 527
        q = AstakosUser.objects.exclude(username=self.username)
528
        q = q.filter(email=self.email)
528
        q = q.filter(email__iexact=self.email)
529 529
        if q.count() != 0:
530 530
            return True
531 531
        return False
......
712 712
                raise EmailChange.DoesNotExist
713 713
            # is there an active user with this address?
714 714
            try:
715
                AstakosUser.objects.get(email=email_change.new_email_address)
715
                AstakosUser.objects.get(email__iexact=email_change.new_email_address)
716 716
            except AstakosUser.DoesNotExist:
717 717
                pass
718 718
            else:

Also available in: Unified diff