@param UsersRepository $repo
@param string          $userLogin

@return Entity\Users|false
972602
protected function getUser(UsersRepository $repo, $userLogin)
    {
        $userEntity = $repo->findOneBy(['username' => $userLogin]);
        if ($userEntity) {
            return $userEntity;
        }

        return $repo->findOneBy(['email' => $userLogin]);
    }
678698
public function all($username, $repository, $issue)
    {
        return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/timeline');
    }
1084399
public function lock($username, $repository, $id)
    {
        return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id).'/lock');
    }
922281
public static function get_by_github_username($github_username) {
	$mysql = bootstrap::get_library('mysql');
	
	$sql   = "SELECT * FROM `login_github` WHERE `github_username` = '%s';";
	$login = $mysql::select('row', $sql, $github_username);
	if (empty($login)) {
		return false;
	}
	
	return new static($login['id']);
}
81177
public static function userCanOnLogs( $log , $action , $value , $username = null)
	{
		if ( is_null( $username ) ) $username = self::getCurrentUsername();
		if ( is_null( $username ) ) return false;
		if ( ! self::userExists( $username ) ) return false;
		if ( in_array( 'admin' , self::$auth['users'][ $username ]['roles'] ) ) return true;
		if ( ! isset( self::$auth['users'][ $username ]['logs'][ $log ][ $action ] ) ) return false;
		return ( self::$auth['users'][ $username ]['logs'][ $log ][ $action ] === $value );
	}
740910
protected function updateUserLogin(Entity\Users $userEntity)
    {
        $userEntity->setLastseen(Carbon::now());
        $userEntity->setLastip($this->getClientIp());
        $userEntity->setFailedlogins(0);
        $userEntity->setThrottleduntil($this->throttleUntil(0));
        $userEntity = $this->updateUserShadowLogin($userEntity);

        // Don't try to save the password on login
        $userEntity->setPassword(null);
        try {
            $saved = $this->getRepositoryUsers()->save($userEntity);
        } catch (NotNullConstraintViolationException $e) {
            // Database needs updating
            $saved = true;
        }
        if ($saved) {
            $this->flashLogger->success(Trans::__("You've been logged on successfully."));

            return true;
        }

        return false;
    }
480253
public static function loginUser( $login, $password, $authenticationMatch = false )
    {
        $user = self::_loginUser( $login, $password, $authenticationMatch );
        if ( $user instanceof eZUser )
        {
            $userID = $user->attribute( 'contentobject_id' );
            $paex = eZPaEx::getPaEx( $userID, true );

            if ( $paex instanceof eZPaEx && $paex->isExpired() )
            {
                self::passwordHasExpired( $user );
                return false;
            }
            else
            {
                self::loginSucceeded( $user );
                return $user;
            }
        }
        else
        {
            self::loginFailed( $user, $login );
            return false;
        }

        return $user;
    }
407228
public function findUserByLogin($login)
    {
        if ($login instanceof UserInterface) {
            return $login;
        }

        $result =   $this->userProvider->findByLogin($login);
        if ($result) {
            return $result;
        }

        $exceptionMessage   =   "A user with the login '%(login)s' cannot be found.";

        throw new UserNotFound(isprintf($exceptionMessage, compact('login')));
    }
1252818
public function sign_in( \Auth\User $user, $keep_login = true ) 
	{
		// set the session key so the session knows we are logged in
		$this->session->set( $this->config->session_key, $user->{$this->config->user_key} );

		// update the current user object
		$this->user = $user;

		// update the last login timestamp
		$this->user->last_login = time();

		// pass the user trough the events to allow modifications
		// of the user object at sign in
		$this->user = \CCEvent::pass( 'auth.sign_in', $this->user );

		// save the user object to the database 
		$this->user->save();

		// set the restore keys to keep the login
		// after the session ends
		if ( $keep_login ) 
		{
			$restore_id_cookie = $this->config->get( 'restore.id_cookie' );
			$restore_token_cookie = $this->config->get( 'restore.token_cookie' );

			$restore_lifetime = $this->config->get( 'restore.lifetime' );

			$restore_id = $this->session->get( $this->config->session_key );
			$restore_token = $this->restore_key( $this->user );

			CCCookie::set( $restore_id_cookie, $restore_id, $restore_lifetime );
			CCCookie::set( $restore_token_cookie, $restore_token, $restore_lifetime );

			// try to get the current login
			$login = $this->select_logins()
				->where( 'restore_id', $restore_id )
				->where( 'restore_token', $restore_token );

			// prepare the login data
			$login_data = array(
				'restore_id' 		=> $restore_id,
				'restore_token' 		=> $restore_token,
				'last_login' 		=> time(),
				'client_agent'		=> \CCIn::client()->agent,
			);

			// pass the login data trough the events
			$login_data = \CCEvent::pass( 'auth.store_login', $login_data );

			// if there is no such login create a new one
			if ( !$login->run() ) 
			{
				\DB::insert( $this->config->get( 'logins.table' ), $login_data )
					->run( $this->config->get( 'logins.handler' ) );
			}
			else 
			{
				\DB::update( $this->config->get( 'logins.table' ), $login_data )
					->where( 'restore_id', $restore_id )
					->where( 'restore_token', $restore_token )
					->run( $this->config->get( 'logins.handler' ) );
			}
		}

		// and finally we are authenticated
		return $this->authenticated = true;
	}
941668
public function createUser($login_name, $organization, $userClassName, $userId)
    {
        $now = new \MUtil_Db_Expr_CurrentTimestamp();;

        $values['gul_user_class'] = $userClassName;
        $values['gul_can_login']  = 1;
        $values['gul_changed']    = $now;
        $values['gul_changed_by'] = $userId;

        $select = $this->db->select();
        $select->from('gems__user_logins', array('gul_id_user'))
                ->where('gul_login = ?', $login_name)
                ->where('gul_id_organization = ?', $organization)
                ->limit(1);

        // Update class definition if it already exists
        if ($login_id = $this->db->fetchOne($select)) {
            $where = implode(' ', $select->getPart(\Zend_Db_Select::WHERE));
            $this->db->update('gems__user_logins', $values, $where);

        } else {
            $values['gul_login']           = $login_name;
            $values['gul_id_organization'] = $organization;
            $values['gul_created']         = $now;
            $values['gul_created_by']      = $userId;

            $this->db->insert('gems__user_logins', $values);
        }

        return $this->getUser($login_name, $organization);
    }
352537
protected function loginFailed(Entity\Users $userEntity)
    {
        $this->flashLogger->error(Trans::__('general.phrase.error-user-name-password-incorrect'));
        $this->systemLogger->info("Failed login attempt for '" . $userEntity->getDisplayname() . "'.", ['event' => 'authentication']);

        // Update the failed login attempts, and perhaps throttle the logins.
        $userEntity->setFailedlogins($userEntity->getFailedlogins() + 1);
        $userEntity->setThrottleduntil($this->throttleUntil($userEntity->getFailedlogins() + 1));
        $userEntity->setPassword(null);
        $this->getRepositoryUsers()->save($userEntity);

        return false;
    }
240284
public function getUserPreference($userLogin, $preferenceName)
    {
        Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);

        $optionValue = $this->getPreferenceValue($userLogin, $preferenceName);

        if ($optionValue !== false) {
            return $optionValue;
        }

        return $this->getDefaultUserPreference($preferenceName, $userLogin);
    }
471328
public function subscribers($username, $repository, $page = 1)
    {
        return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/subscribers', [
            'page' => $page,
        ]);
    }
42966
protected function loadEzUser($login)
    {
        if (empty($login)) {
            return null;
        }

        /** @var \eZ\Publish\API\Repository\UserService $userService */
        $userService = $this->getContainer()->get('ezpublish.api.service.user');

        try {
            return $userService->loadUserByLogin($login);
        } catch (NotFoundException $e) {
            return null;
        }
    }
525095
public function getUsers($userLogins = '')
    {
        Piwik::checkUserHasSomeAdminAccess();

        if (!is_string($userLogins)) {
            throw new \Exception('Parameter userLogins needs to be a string containing a comma separated list of users');
        }

        $logins = array();

        if (!empty($userLogins)) {
            $logins = explode(',', $userLogins);
        }

        $users = $this->model->getUsers($logins);
        $users = $this->userFilter->filterUsers($users);
        $users = $this->enrichUsers($users);

        return $users;
    }
375885
private function resolvePull($user, $repo, $reference)
    {
        if (!$pull = $this->parseRefAsPull($reference)) {
            return null;
        }

        $api = $this->client->api('pull_request');
        $params = [$user, $repo, $pull];

        $data = $this->callGitHub([$api, 'show'], $params);
        return $data['head']['sha'] ?? null;
    }
154306
protected function getUserEntity($userName)
    {
        if (!$userEntity = $this->getRepositoryUsers()->getUser($userName)) {
            $this->flashLogger->error(Trans::__('general.phrase.error-user-name-password-incorrect'));

            return null;
        }

        if (!$userEntity->getEnabled()) {
            $this->systemLogger->alert("Attempt to login with disabled account by '$userName'", ['event' => 'security']);
            $this->flashLogger->error(Trans::__('general.phrase.login-account-disabled'));

            return null;
        }

        return $userEntity;
    }