Load cookies for this username and check if it was logged in.
@param string $username
@return bool
13280
public function autoLogin($username)
    {
        $this->loadCookiesFor($username);

        if (!$this->httpClient->cookie('_auth')) {
            return false;
        }

        $this->login();

        return true;
    }
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));
    }
371013
public static function isUser(string $username): bool {
		$userdbname = setup::getValidation("username");
		if (R::findOne('user', ' ' . $userdbname . ' = ? ', [$username])) {
			return true;
		}

		return false;
	}
1011908
public function authenticate($username, $password)
    {
        if ($user = $this->find($username)) {
            if ($user->account) {
                if ($this->passwordVerify($password, $user->account->password)) {
                    if ($this->passwordRehash($password)) {
                        $user->account->update([
                            'id'       => $user->id,
                            'password' => $this->passwordHash($password),
                        ]);
                    }

                    $account = $user->account->getArrayCopy();
                }
            } elseif ($this->passwordVerify($password, $user->password)) {
                $account = $user->getArrayCopy();
            }

            if (isset($account)) {
                foreach ($account as $key => $value) {
                    if (strpos($key, 'record') !== false) {
                        unset($account[ $key ]);
                    } elseif (in_array($key,
                        ['password', 'pin', 'token', 'sso', 'id_sys_user', 'id_sys_module', 'id_sys_module_role'])) {
                        unset($account[ $key ]);
                    }
                }

                $this->login($account);

                return true;
            }
        }

        return false;
    }
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();
    }
394769
public function loadUserByUsername($username): User
    {
        foreach ($this->userRepositoryCollection->all() as $repository) {
            $user = $repository->findByUsername($username);

            if ($user instanceof User) {
                return $user;
            }
        }

        throw new UsernameNotFoundException(
            sprintf('Username "%s" does not exist.', $username)
        );
    }
346747
public function authenticateUser($username)
    {
        if ($username)
        {
            $user = $this->userManager->findUserBy(['username' => $username]);

            if ($user)
            {
                $usernamePasswordToken = new UsernamePasswordToken($user->getUsername(), $user->getPlainPassword(), 'default', $user->getRoles());
                $this->tokenStorage->setToken($usernamePasswordToken);

                return $user;
            }
        }
        return false;
    }
887279
public function loadUserByUsername($username)
    {
        if ($username !== 'testUsername') {
            return false;
        }

        /** @var UserInterface $user */
        $user = new \stdClass();
        $user->id = 123;
        $user->username = $username;
        $user->firstName = 'aName';
        $user->lastName = 'aSurname';

        return $user;
    }
1153076
protected function _loginUser($username, $data = array())
    {
        //Set user data in context
        $data = $this->getObject('user.provider')->load($username)->toArray();
        $data['authentic'] = true;

        $this->getObject('user')->setData($data);

        // Explicitly authenticate user
        $this->getObject('user')->setAuthentic();

        return true;
    }
332519
public function load(string $className): bool
   {
       if (($fileName = $this->fileName($className))) {
           require $fileName;
           return true;
       } 
       return false;
   }
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;
    }
966397
public function isUsernameUnique($username)
    {
        if ($username) {
            try {
                $this->userRepository->findUserByUsername($username);
            } catch (NoResultException $exc) {
                return true;
            }
        }

        return false;
    }
1121832
public function chown($username) {

		if(false === is_string($username)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($username)), E_USER_ERROR);
		}

		if(false !== $this -> directory -> getExists()) {
			return chown($this -> directory -> getPath(), $username);
		}

		return false;
	}
949106
public function getUserByUsername($username)
    {
        $return = array();

        $users = $this->repository->users;
        foreach ($users as $user) {
            if ($user->username == $username) {
                $return = $user;
                break;
            }
        }

        return $return;
    }
1045977
public function hijackLogin($username)
    {
        //Translate email login to username
        if (is_email($username)) {
            $username = $this->emailToUsername($username);
        }

        //Store to class
        $this->username = $username;
        $this->password = isset($_POST['pwd']) ? $_POST['pwd'] : "";
        $this->userId   = $this->getUserID($username);

        if (is_numeric($this->userId) && !empty($this->userId)) {

            //Init required classes
            $this->curl = new Helper\Curl();
            $this->profile = new Profile();

            //Fetch user from api
            $result = $this->fetchUser($this->username, $this->password);

            //Abort if theres a error
            if($result !== false) {
                    
                //Validate signon
                if ($this->validateLogin($result, $this->username) && $result !== false) {

                    //Update user profile
                    $this->profile->update($result, $this->userId);

                    //Signon
                    $this->signOn(array(
                        'user_login' => $this->username,
                        'user_password' => $this->password,
                        'remember' => isset($_POST['rememberme']) && $_POST['rememberme'] == "forever" ? true : false
                    ));

                    //Redirect to admin panel / frontpage
                    if (in_array('subscriber', (array) get_userdata($this->userId)->roles)) {

                        //Get bulitin referer
                        if (isset($_POST['_wp_http_referer'])) {
                            $referer = $_POST['_wp_http_referer'];
                        } else {
                            $referer = "/";
                        }

                        //Redirect to correct url
                        if (is_multisite()) {
                            wp_redirect(apply_filters('adApiWpIntegration/login/subscriberRedirect', network_home_url($referer)));
                            exit;
                        }
                        wp_redirect(apply_filters('adApiWpIntegration/login/subscriberRedirect', home_url($referer)));
                        exit;
                    }

                    wp_redirect(apply_filters('adApiWpIntegration/login/defaultRedirect', admin_url("?auth=active-directory")));
                    exit;
                }
            }
        }
    }
423797
public function getUser($username)
    {
        $resellers = $this->getUsers();
        return isset($resellers[$username]) ? $resellers[$username] : null;
    }
1016791
public static function deleteUser($username)
	{
		if ( ! self::userExists( $username ) ) return false;

		$deleted_user = self::$auth['users'][ $username ];
		unset( self::$auth['users'][ $username ] );

		return $deleted_user;
	}