models/AccountLoginForm.php
public function getUser()
	{
		if ($this->_user === FALSE) {
			if (UserModule::$loginType == User::LOGIN_TYPE_EMAIL) {
				$this->_user = UserIdentity::findByEmail($this->username);
			} elseif (UserModule::$loginType == User::LOGIN_TYPE_USERNAME) {
				$this->_user = UserIdentity::findByUsername($this->username);
			} elseif (UserModule::$loginType == User::LOGIN_TYPE_BOTH) {
				$this->_user = UserIdentity::findByUsernameOrEmail($this->username);
			}
		}

		return $this->_user;
	}
public function getUser()
	{
		if ($this->_user === FALSE) {
			if (UserModule::$loginType == User::LOGIN_TYPE_EMAIL) {
				$this->_user = UserIdentity::findByEmail($this->username);
			} elseif (UserModule::$loginType == User::LOGIN_TYPE_USERNAME) {
				$this->_user = UserIdentity::findByUsername($this->username);
			} elseif (UserModule::$loginType == User::LOGIN_TYPE_BOTH) {
				$this->_user = UserIdentity::findByUsernameOrEmail($this->username);
			}
		}

		return $this->_user;
	}
Finds user by [[username]]

@return User|null