def verify_user(user):
 if (not user.email):
  raise ValidationError(("You cannot verify an account with no email set. You can set this user's email with 'pootle update_user_email %s EMAIL'" % user.username))
 try:
  validate_email_unique(user.email, user)
 except ValidationError:
  raise ValidationError("This user's email is not unique. You can find duplicate emails with 'pootle find_duplicate_emails'")
 existing_primary = EmailAddress.objects.filter(user=user, primary=True)
 if existing_primary.exists():
  existing_primary = existing_primary.first()
  if (not existing_primary.verified):
   existing_primary.verified = True
   existing_primary.save()
   return
  else:
   raise ValueError(("User '%s' is already verified" % user.username))
 sync_user_email_addresses(user)
 email_address = EmailAddress.objects.filter(user=user, email__iexact=user.email).order_by('primary').first()
 email_address.verified = True
 email_address.primary = True
 email_address.save()

def verify_user ( user ) : if ( not user . email ) : raise ValidationError ( ( "You cannot verify an account with no email set. You can set this user's email with 'pootle update_user_email %s EMAIL'" % user . username ) ) try : validate_email_unique ( user . email , user ) except ValidationError : raise ValidationError ( "This user's email is not unique. You can find duplicate emails with 'pootle find_duplicate_emails'" ) existing_primary = EmailAddress . objects . filter ( user = user , primary = True ) if existing_primary . exists ( ) : existing_primary = existing_primary . first ( ) if ( not existing_primary . verified ) : existing_primary . verified = True existing_primary . save ( ) return else : raise ValueError ( ( "User '%s' is already verified" % user . username ) ) sync_user_email_addresses ( user ) email_address = EmailAddress . objects . filter ( user = user , email__iexact = user . email ) . order_by ( 'primary' ) . first ( ) email_address . verified = True email_address . primary = True email_address . save ( )
verify a user account without email confirmation if the user has an existing primary allauth .