Revision 4bdd7e3d

b/snf-astakos-app/astakos/im/forms.py
359 359
                                         'recaptcha_response_field', ])
360 360

  
361 361
    def clean_username(self):
362
        if 'username' in self.cleaned_data:
363
            return self.cleaned_data['username'].lower()
362
        return self.cleaned_data['username'].lower()
364 363

  
365 364
    def clean_recaptcha_response_field(self):
366 365
        if 'recaptcha_challenge_field' in self.cleaned_data:
......
475 474
    def clean_email(self):
476 475
        email = super(ExtendedPasswordResetForm, self).clean_email()
477 476
        try:
478
            user = AstakosUser.objects.get(email__iexact=email, is_active=True)
477
            user = AstakosUser.objects.get(email__iexact=email)
479 478
            if not user.has_usable_password():
480 479
                raise forms.ValidationError(_(astakos_messages.UNUSABLE_PASSWORD))
481 480

  
b/snf-astakos-app/astakos/im/functions.py
287 287
    Raises SendGreetingError, ValidationError
288 288
    """
289 289
    user.is_active = True
290
    if verify_email:
291
        user.email_verified = True
290
    user.email_verified = True
292 291
    user.save()
293 292
    send_helpdesk_notification(user, helpdesk_email_template_name)
294 293
    send_greeting(user, email_template_name)
b/snf-astakos-app/astakos/im/management/commands/user-activation-send.py
47 47
            raise CommandError("No user was given")
48 48

  
49 49
        for email_or_id in args:
50
            user = get_user(email_or_id, is_active=False)
50
            user = get_user(email_or_id)
51 51
            if not user:
52 52
                self.stderr.write("Unknown user '%s'\n" % (email_or_id,))
53 53
                continue
54
            if user.is_active:
54
            if user.email_verified and user.is_active:
55 55
                self.stderr.write(
56 56
                    "Already active user '%s'\n" % (email_or_id,))
57 57
                continue
b/snf-astakos-app/astakos/im/management/commands/user-update.py
125 125

  
126 126
        if options.get('active'):
127 127
            user.is_active = True
128
            if not user.email_verified:
129
                user.email_verified = True
130
            if not user.activation_sent:
131
                user.activation_sent = True
128 132
        elif options.get('inactive'):
129 133
            user.is_active = False
130 134

  
b/snf-astakos-app/astakos/im/models.py
504 504
            self.username = self.email
505 505

  
506 506
        self.validate_unique_email_isactive()
507
        if self.is_active and self.activation_sent:
508
            # reset the activation sent
509
            self.activation_sent = None
510 507

  
511 508
        super(AstakosUser, self).save(**kwargs)
512 509

  
......
556 553
        """
557 554
        q = AstakosUser.objects.all()
558 555
        q = q.filter(email = self.email)
559
        q = q.filter(is_active = self.is_active)
560 556
        if self.id:
561 557
            q = q.filter(~Q(id = self.id))
562 558
        if q.count() != 0:
b/snf-astakos-app/astakos/im/util.py
209 209

  
210 210

  
211 211
def reserved_email(email):
212
    return AstakosUser.objects.filter(email__iexact=email).count() != 0
212
    return AstakosUser.objects.filter(email__iexact=email).count() > 0 or \
213
        AstakosUser.objects.filter(username__iexact=email).count() > 0
213 214

  
214 215

  
215 216
def get_query(request):

Also available in: Unified diff