frontend/models/forms/LoginForm.php
/**
     * Logs in a user using the provided username and password.
     *
     * @return boolean whether the user is logged in successfully
     */
Logs in a user using the provided username and password.
@return boolean whether the user is logged in successfully
Logs in a user using the provided username and password . @return boolean whether the user is logged in successfully
public function login()
    {
            $user = $this->getUser();
            $ip = null;
            $ip = Yii::$app->request->getUserIP();
            if (!$ip) { $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null; }
            if (!$ip) { $ip = '127.0.0.1'; }
            $user->user_last_ip = $ip;
            if ($user->save()) {
                BadLogins::removeIpFromList($ip, BadLogins::TYPE_LOCK_LOGIN);
                BadLogins::removeIpFromList($ip, BadLogins::TYPE_LOCK_RESET);
                return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 365 : 0);
            }
        return false;
    }
public function login ( ) { $ user = $ this -> getUser ( ) ; $ ip = null ; $ ip = Yii :: $ app -> request -> getUserIP ( ) ; if ( ! $ ip ) { $ ip = isset ( $ _SERVER [ 'REMOTE_ADDR' ] ) ? $ _SERVER [ 'REMOTE_ADDR' ] : null ; } if ( ! $ ip ) { $ ip = '127.0.0.1' ; } $ user -> user_last_ip = $ ip ; if ( $ user -> save ( ) ) { BadLogins :: removeIpFromList ( $ ip , BadLogins :: TYPE_LOCK_LOGIN ) ; BadLogins :: removeIpFromList ( $ ip , BadLogins :: TYPE_LOCK_RESET ) ; return Yii :: $ app -> user -> login ( $ this -> getUser ( ) , $ this -> rememberMe ? 3600 * 24 * 365 : 0 ) ; } return false ; }
Logs in a user using the provided username and password.
Logs in a user using the provided username and password .
//if ($this->validate()) { /* если успешно авторизованы, то удалить из списка */ //} //var_dump($this->getErrors()); exit;