хочу изменить вход на авторизацию только по логину, без пароля
сейчас сделано примерно так
des1roer.blogspot.ru/2015/03/yii-yii-for-dummies-a...
думаю protected\components\UserIdentity.php надо менять
public function authenticate($silent = null)
{
$adldap = Yii::app()->ldap;
$user = User::model()->find('LOWER(login)=?', array(strtolower($this->username)));
$username = strtolower($this->username);
$password = $this->password;
$authUser = $adldap->user()->authenticate($username, $password);
$ldapuser = null;
if (empty($this->username)) $ldapuser = User::model()->find('LOWER(login)=?', array(strtolower(getenv("username"))));
if ($ldapuser && !empty($silent))
{
$this->_id = $ldapuser->id;
$this->username = $ldapuser->login;
$this->errorCode = self::ERROR_NONE;
}
else if ($user === null)
$this->errorCode = self::ERROR_USERNAME_INVALID;
else if ($authUser == true && isset($user))
{
$this->_id = $user->id;
$this->username = $user->login;
$this->errorCode = self::ERROR_NONE;
}
else if (!$user->validatePassword($this->password) && empty($silent))
$this->errorCode = self::ERROR_PASSWORD_INVALID;
else if ($user->ban == 1)
{
$this->errorCode = self::ERROR_UNKNOWN_IDENTITY;
$cs = Yii::app()->getClientScript();
$cs->registerScript(
'my-hello-world-1',
'var popup = "Вы заблокированы. Можете обратиться в ДИТ";
alert(popup);',
CClientScript::POS_END
);
}
else
{
$this->_id = $user->id;
$this->username = $user->login;
$this->errorCode = self::ERROR_NONE;
}
return !$this->errorCode;
}