Find a user match with username and email
    :param username:
    :param email:
    :returns:
553802
def user_query(username, email):
    
    query = db.query(User)
    if username:
        query = query.filter_by(username=username)

    if email:
        query = query.filter_by(username=username)

    return query
1107950
def check_user(self, username, email):
        ''''''
        users = self.router.user
        avail = yield users.filter(username=username).count()
        if avail:
            raise FieldError('Username %s not available' % username)
        if email:
            avail = yield users.filter(email=email).count()
            if avail:
                raise FieldError('Email %s not available' % email)
152949
def get_by_username(cls, username):
        
        return cls.query.filter(
            UserProfile._username == username.lower()
        ).one()
53456
def user_has_email(username):
    
    user = api.user.get(username=username)
    if not user.getProperty("email"):
        msg = _(
            "This user doesn't have an email associated "
            "with their account."
        )
        raise Invalid(msg)

    return True
152025
def register_by_email(self, email, sender=None, request=None, **kwargs):
        
        try:
            user = self.user_model.objects.get(email=email)
        except self.user_model.DoesNotExist:
            user = self.user_model.objects.create(
                username=self.get_username(),
                email=email,
                password=self.user_model.objects.make_random_password(),
            )
            user.is_active = False
            user.save()
        self.send_activation(user, sender, **kwargs)
        return user
251991
def search
      user = User.where("email = ? AND id != ?", params[:email], @user.id).first
      if user
        render json: user
      else
        render json: {}, status: :not_found
      end
    end
450064
def get_user_info(self, username):
        
        info = self.get_users_info([username])
        return info[username] if info is not None else None
564200
def get(self, mail):
        
        users = (v for v in self.list() if v.get('mail') == mail)
        for i in users:
            self.log.debug(i)
            return i
        return None
1002836
def change_email(self, email, as_username=False):
        
        email = email.lower()
        data = {"email": email}
        if self.email != email:
            if self.get_by_email(email):
                raise exceptions.AuthError("Email exists already")
            if as_username:
                if self.username != email:
                    if self.get_by_username(email):
                        raise exceptions.AuthError("Username exists already")
                data["username"] = email

            self.update(**data)
841634
def get_user(self, username):
        

        r = self._query_('/users/%s' % username, 'GET')

        result = User(r.json())
        return result
1242674
def process_email(ctx, param, value):
    """"""
    user = User.query.filter(User.email == value).first()
    if not user:
        raise click.BadParameter('User with email \'%s\' not found.', value)
    return user
412223
public function findUserByUsernameOrEmail($usernameOrEmail)
    {
        if (filter_var($usernameOrEmail, FILTER_VALIDATE_EMAIL)) {
            return $this->findUserByEmail($usernameOrEmail);
        }

        return $this->findUserByUsername($usernameOrEmail);
    }
1117639
def _get_user(self, username, attrs=ALL_ATTRS):
        """"""

        username = ldap.filter.escape_filter_chars(username)
        user_filter = self.user_filter_tmpl % {
            'username': self._uni(username)
        }
        r = self._search(self._byte_p2(user_filter), attrs, self.userdn)

        if len(r) == 0:
            return None

        # if NO_ATTR, only return the DN
        if attrs == NO_ATTR:
            dn_entry = r[0][0]
        # in other cases, return everything (dn + attributes)
        else:
            dn_entry = r[0]
        return dn_entry
538851
public function findUserByUsernameOrEmail($username, $email)
    {
        $dql = '
            SELECT u
            FROM Claroline\CoreBundle\Entity\User u
            WHERE u.username = :username
            OR u.email = :email
            AND u.isRemoved = false
        ';

        $query = $this->_em->createQuery($dql);
        $query->setParameter('username', $username);
        $query->setParameter('email', $email);

        return $query->getResult();
    }
208756
def get_member_info_by_email(self, *args, **kwargs):
        
        return bind_api(
            api=self,
            path='/members/email/{email}',
            payload_type='author',
            allowed_param=['email']
        )(*args, **kwargs)
625675
def get_user_by_username(self, username):
        
        results = self.get_users(filter='username eq "%s"' % (username))
        if results['totalResults'] == 0:
            logging.warning("Found no matches for given username.")
            return
        elif results['totalResults'] > 1:
            logging.warning("Found %s matches for username %s" %
                (results['totalResults'], username))

        return results['resources'][0]
864728
def get_users(username):
    
    reply = {}

    log.debug('Begin /v[x]/users/' + username)

    if username is None:
        reply['error'] = "No username given"
        return jsonify(reply), 404

    if ',' in username:
        reply['error'] = 'Multiple username queries are no longer supported.'
        return jsonify(reply), 401


    if "." not in username:
        fqa = "{}.{}".format(username, 'id')
    else:
        fqa = username

    profile = get_profile(fqa)

    reply[username] = profile
    if 'error' in profile:
        status_code = 200
        if 'status_code' in profile:
            status_code = profile['status_code']
            del profile['status_code']
        return jsonify(reply), status_code
    else:
        return jsonify(reply), 200