Set username

@param  string $username
@return Url
169018
public function setUsername($username, $password = null) {
		$this->username = (string) $username;
		
		if ($password !== null) {
			$this->setPassword($password);
		}
		
		return $this;
	}
1277039
public function setUsername($username)
    {
        if (preg_match(self::PATTERN_MATCH_USERNAME, $username) !== 1) {
            throw new \InvalidArgumentException('"' . $username . '" is not a valid username.', 1184071238);
        }

        $this->username = $username;
    }
29750
public function setUser($username)
    {
        $app = App::getInstance();

        try {
            parent::__construct($username);
        } catch (\FelixOnline\Exceptions\ModelNotFoundException $e) {
            User::createUser($username);
            parent::__construct($username);
        }

        $user = new User($username);
        $this->logIn($user);
        $this->user = $user;
    }
281973
public function rename($username)
    {
        if ($username !== $this->username) {
            $oldUsername = $this->username;
            $this->username = $username;

            $this->raise(new Renamed($this, $oldUsername));
        }

        return $this;
    }
515699
protected function invalidateUsername($username)
    {
        $this->_mixer->set('body', AnHelperString::str_ireplace('@'.$username, $username, $this->_mixer->body));
    }
441006
public function setName($name)
    {
        $familyName = $givenName = '';

        if (strpos($name, ' ')) {
            list($givenName, $familyName) = explode(' ', $name, 2);
        } else {
            $givenName = $name;
        }

        $this->set('givenName', $givenName);
        $this->set('familyName', $familyName);
        $this->set('name', $name);

        return $this;
    }
907506
public function setAuthentication($username, $password)
    {
        $this->_mailer->Username = $username;
        $this->_mailer->Password = $password;

        return $this;
    }
702701
public function getByUsername(string $username)
	{
		return $this->setAuthorizer($this->getModel()->where('username', '=', $username)->first());
	}
1202827
public function setDn($username, $nosub = 0)
	{
		if ($this->users_dn == '' || $nosub)
		{
			$this->dn = $username;
		}
		elseif (\strlen($username))
		{
			$this->dn = str_replace('[username]', $username, $this->users_dn);
		}
		else
		{
			$this->dn = '';
		}
	}
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();
    }
657596
public function setSiteName($siteName)
    {
        $this->meta()->setSiteName($siteName);
        $this->openGraph()->setSiteName($siteName);

        return $this;
    }
766521
private function setName($name)
    {
        $name       = trim(strip_tags($name));
        $this->name = str_replace([' '], '-', $name);

        return $this;
    }
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));
    }
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();
    }
160265
public function loadUserByUsername($username)
    {
        $slackUser = $this->client->getSlackUserFromOAuthCode($username);

        if (!$slackUser->isValid()) {
            throw new UsernameNotFoundException('No access token found.');
        }

        $user = $this->userService->findBySlackUserId($slackUser->getUserId());

        if (!empty($user)) {
            return $user;
        }

        $user = $this->userService->findUserByEmail($slackUser->getEmail());

        if (!empty($user)) {
            $user->setSlackUserId($slackUser->getUserId());

            return $user;
        }

        return $this->registerUser($slackUser);
    }
119219
public function loadUserByUsername($username)
    {
        if (!isset($this->cachedUsers[$username])) {
            $this->cachedUsers[$username] = $this->userProvider->loadUserByUsername($username);
        }
        return $this->cachedUsers[$username];
    }
289319
public function userCheckName($username)
    {
        $params =  compact('username');
        $validator = Validator::make($params, [
            'username' => 'uc_username'
        ]);
        if ($validator->fails())
            throw new UcException('用户名不合法', -1);


        $response = $this->apiPost('user', 'check_username', $params);
        if (0 > $response) {
            switch ($response) {
                case '-1':
                    throw new UcException('用户名不合法', -1);
                    break;
                case '-2':
                    throw new UcException('包含要允许注册的词语', -2);
                    break;
                case '-3':
                    throw new UcException('用户名已经存在', -3);
                    break;
                default:
                    throw new UcException('未知错误', $response);
                    break;
            }
        }
        return true;
    }