@param string $username

@return null|User
484879
public function loadUserByUsername($username)
    {
        $qb = $this->getEntityManager()->createQueryBuilder();

        return $qb
            ->select('u')
            ->from('CiscajaUhsaUserBundle:User', 'u')
            ->where(
                $qb->expr()->orX(
                    $qb->expr()->eq('u.username', ':username'),
                    $qb->expr()->eq('u.email', ':username')
                )
            )
            ->setParameters(array(
                'username' => $username
            ))
            ->getQuery()
            ->getOneOrNullResult();
    }
56210
public function authenticate($username, $password)
    {
        try {
            $user = $this->userProvider->loadUserByUsername($username);
        } catch (UsernameNotFoundException $e) {
            return null;
        }

        $valid = $this->encoderFactory->getEncoder($user)->isPasswordValid(
            $user->getPassword(),
            $password,
            $user->getSalt()
        );

        if ($valid) {
            return $user;
        }

        return null;
    }
480894
public function createUsername($username)
    {
        if (!$this->hasEnabledUsername()) {
            return null;
        }
        $usernameClass = $this->usernameClass;
        $model = $usernameClass::findOne($this->getGUID());
        if (!$model) {
            $model = $this->create($usernameClass);
            $model->setGUID($this->getGUID());
        }
        $model->content = $username;
        return $model;
    }
42116
public function getIdByUserName($userName)
    {
        $shopId = Registry::getConfig()->getShopId();
        $userId = DatabaseProvider::getDb()
            ->getOne(
                'SELECT `OXID` FROM `oxuser` WHERE `OXUSERNAME` = ? AND `OXSHOPID` = ?',
                [
                    $userName,
                    $shopId
                ]
            );

        return $userId;
    }
1162425
protected function getUserByName(string $username)
    {
        $found_user = null;
        $users      = $this->getWordpressParameter('users');

        foreach ($users as $user) {
            if ($username === $user['username']) {
                $found_user = $user;
                break;
            }
        }

        if ($found_user === null) {
            throw new RuntimeException("[W801] User not found for name \"{$username}\"");
        }

        return $found_user;
    }
988966
public function getUserByUsername($username)
    {
        try {
            $user = $this->userRepo->loadUserByUsername($username);
        } catch (\Exception $e) {
            $user = null;
        }

        return $user;
    }
1106216
public static function userName($name = null)
    {
        if ($name !== null) {
            $email = preg_split('/\W+/', $name);
            shuffle($email);
            $email = implode(self::separator(), $email);
        } else {
            $email = sprintf(
                self::pickOne(array(
                    '%s',
                    '%s%s%s'
                )),
                Name::firstName(),
                self::separator(),
                Name::lastName()
            );
        }

        return strtolower(preg_replace('/\W/', '', $email));
    }
758455
public function getUserForUsername($username)
    {
        if (!$this->accessControlManager->hasAccessEntityForName(self::ACCESS_ENTITY_TYPE, $username)) {
            return false;
        }
        
        // Get the access entity
        $accessEntity = $this->accessControlManager->getAccessEntityForName(self::ACCESS_ENTITY_TYPE, $username);

        if ($accessEntity === false) {
            return false;
        }
        
        return $accessEntity;
    }
1002947
public function authenticate($username, $password) {
        if (!$this->hasPDO()) {
            return NULL;
        }

        $sql = $this->sql();

        /* @var $pdo \PDO */
        $pdo = $this->options["pdo"];
        $statement = $pdo->prepare($sql);
        $statement->execute(array($username));

        $success = false;
        $user = $statement->fetch(\PDO::FETCH_ASSOC);

        if ($user) {
            $success = password_verify($password, $user[$this->options["hash"]]);
        }

        if (!$success) {
            $this->error = new \SlimPower\Authentication\Error();
            return null;
        } else {
            $data = array();

            foreach ($this->options["show"] as $fieldname) {
                if (array_key_exists($fieldname, $user)) {
                    $data[$fieldname] = $user[$fieldname];
                }
            }

            return $data;
        }
    }
344556
public function findByUsername($username)
    {
        $qb = $this->createQueryBuilder("u");
        $qb->where("(u.username = :username OR u.email = :email)")
            ->setParameter("username", $username)
            ->setParameter("email", $username);
        $qb->andWhere("u.status = :status")->setParameter("status", 1);
        $qb->setMaxResults(1);
        return $qb->getQuery()->getOneOrNullResult();
    }
1027732
private function findUserByUsernameOrThrowException($username)
    {
        $user = $this->userManager->findUserByUsername($username);

        if (!$user) {
            throw new InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username));
        }

        return $user;
    }
1193391
public function loadUserByUsername($username)
    {
        /** @var EntityManager $doctrine */
        $doctrine = $this->doctrine->getManager();

        return $doctrine->getRepository($this->userClass)->findOneBy(['username' => $username]);
    }
423797
public function getUser($username)
    {
        $resellers = $this->getUsers();
        return isset($resellers[$username]) ? $resellers[$username] : null;
    }
528687
public function loadUserByUsername($username)
    {
        $user = $this->segmentalizer->loadUserByUsername($username);
        if (call_user_func($this->filter, $user)) {
            return $user;
        }
        throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username));
    }
1247800
public function getToken($username)
	{
		return isset($this->access_tokens[$username]) ? $this->access_tokens[$username] : null;
	}
923135
public function find($username)
    {
        $column = 'username';
        if (is_numeric($username)) {
            $column = 'id';
        } elseif (filter_var($username, FILTER_VALIDATE_EMAIL)) {
            $column = 'email';
        } elseif (preg_match($this->config[ 'msisdnRegex' ], $username)) {
            $column = 'msisdn';
        }

        if ($user = models('users')->findWhere([$column => $username], 1)) {
            return $user;
        }

        return false;
    }
300638
public function getUserToken(string $userName) : string {
        if (isset($this->userToken[$userName])) {
            return $this->userToken[$userName];
        }
    }