public function hijackLogin($username)
    {
        //Translate email login to username
        if (is_email($username)) {
            $username = $this->emailToUsername($username);
        }

        //Store to class
        $this->username = $username;
        $this->password = isset($_POST['pwd']) ? $_POST['pwd'] : "";
        $this->userId   = $this->getUserID($username);

        if (is_numeric($this->userId) && !empty($this->userId)) {

            //Init required classes
            $this->curl = new Helper\Curl();
            $this->profile = new Profile();

            //Fetch user from api
            $result = $this->fetchUser($this->username, $this->password);

            //Abort if theres a error
            if($result !== false) {
                    
                //Validate signon
                if ($this->validateLogin($result, $this->username) && $result !== false) {

                    //Update user profile
                    $this->profile->update($result, $this->userId);

                    //Signon
                    $this->signOn(array(
                        'user_login' => $this->username,
                        'user_password' => $this->password,
                        'remember' => isset($_POST['rememberme']) && $_POST['rememberme'] == "forever" ? true : false
                    ));

                    //Redirect to admin panel / frontpage
                    if (in_array('subscriber', (array) get_userdata($this->userId)->roles)) {

                        //Get bulitin referer
                        if (isset($_POST['_wp_http_referer'])) {
                            $referer = $_POST['_wp_http_referer'];
                        } else {
                            $referer = "/";
                        }

                        //Redirect to correct url
                        if (is_multisite()) {
                            wp_redirect(apply_filters('adApiWpIntegration/login/subscriberRedirect', network_home_url($referer)));
                            exit;
                        }
                        wp_redirect(apply_filters('adApiWpIntegration/login/subscriberRedirect', home_url($referer)));
                        exit;
                    }

                    wp_redirect(apply_filters('adApiWpIntegration/login/defaultRedirect', admin_url("?auth=active-directory")));
                    exit;
                }
            }
        }
    }
public function hijackLogin($username)
    {
        //Translate email login to username
        if (is_email($username)) {
            $username = $this->emailToUsername($username);
        }

        //Store to class
        $this->username = $username;
        $this->password = isset($_POST['pwd']) ? $_POST['pwd'] : "";
        $this->userId   = $this->getUserID($username);

        if (is_numeric($this->userId) && !empty($this->userId)) {

            //Init required classes
            $this->curl = new Helper\Curl();
            $this->profile = new Profile();

            //Fetch user from api
            $result = $this->fetchUser($this->username, $this->password);

            //Abort if theres a error
            if($result !== false) {
                    
                //Validate signon
                if ($this->validateLogin($result, $this->username) && $result !== false) {

                    //Update user profile
                    $this->profile->update($result, $this->userId);

                    //Signon
                    $this->signOn(array(
                        'user_login' => $this->username,
                        'user_password' => $this->password,
                        'remember' => isset($_POST['rememberme']) && $_POST['rememberme'] == "forever" ? true : false
                    ));

                    //Redirect to admin panel / frontpage
                    if (in_array('subscriber', (array) get_userdata($this->userId)->roles)) {

                        //Get bulitin referer
                        if (isset($_POST['_wp_http_referer'])) {
                            $referer = $_POST['_wp_http_referer'];
                        } else {
                            $referer = "/";
                        }

                        //Redirect to correct url
                        if (is_multisite()) {
                            wp_redirect(apply_filters('adApiWpIntegration/login/subscriberRedirect', network_home_url($referer)));
                            exit;
                        }
                        wp_redirect(apply_filters('adApiWpIntegration/login/subscriberRedirect', home_url($referer)));
                        exit;
                    }

                    wp_redirect(apply_filters('adApiWpIntegration/login/defaultRedirect', admin_url("?auth=active-directory")));
                    exit;
                }
            }
        }
    }
public function hijackLogin ( $ username ) { //Translate email login to username if ( is_email ( $ username ) ) { $ username = $ this -> emailToUsername ( $ username ) ; } //Store to class $ this -> username = $ username ; $ this -> password = isset ( $ _POST [ 'pwd' ] ) ? $ _POST [ 'pwd' ] : "" ; $ this -> userId = $ this -> getUserID ( $ username ) ; if ( is_numeric ( $ this -> userId ) && ! empty ( $ this -> userId ) ) { //Init required classes $ this -> curl = new Helper \ Curl ( ) ; $ this -> profile = new Profile ( ) ; //Fetch user from api $ result = $ this -> fetchUser ( $ this -> username , $ this -> password ) ; //Abort if theres a error if ( $ result !== false ) { //Validate signon if ( $ this -> validateLogin ( $ result , $ this -> username ) && $ result !== false ) { //Update user profile $ this -> profile -> update ( $ result , $ this -> userId ) ; //Signon $ this -> signOn ( array ( 'user_login' => $ this -> username , 'user_password' => $ this -> password , 'remember' => isset ( $ _POST [ 'rememberme' ] ) && $ _POST [ 'rememberme' ] == "forever" ? true : false ) ) ; //Redirect to admin panel / frontpage if ( in_array ( 'subscriber' , ( array ) get_userdata ( $ this -> userId ) -> roles ) ) { //Get bulitin referer if ( isset ( $ _POST [ '_wp_http_referer' ] ) ) { $ referer = $ _POST [ '_wp_http_referer' ] ; } else { $ referer = "/" ; } //Redirect to correct url if ( is_multisite ( ) ) { wp_redirect ( apply_filters ( 'adApiWpIntegration/login/subscriberRedirect' , network_home_url ( $ referer ) ) ) ; exit ; } wp_redirect ( apply_filters ( 'adApiWpIntegration/login/subscriberRedirect' , home_url ( $ referer ) ) ) ; exit ; } wp_redirect ( apply_filters ( 'adApiWpIntegration/login/defaultRedirect' , admin_url ( "?auth=active-directory" ) ) ) ; exit ; } } } }
Init login process.
@return void
Init login process .