Есть функция аутентификации (взята из хабра)
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- public function login() {
- if ($this->_identity === null) {
- $this->_identity = new UserIdentity($this->username, $this->password);
- $this->_identity->authenticate();
- }
- if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) {
- $duration = $this->rememberMe ? 3600 * 24 * 7 : 0; // 1 неделя
- Yii::app()->user->login($this->_identity, $duration);
- return true;
- } else
- return false;
- }