protected function _login($username, $password, $application)
    {
        // If we did receive the user credentials from the user, try to login
        if($application->login(array('username' => $username, 'password' => $password)) !== true) {
            return false;
        }

        // If we have logged in succesfully, make sure to fullfil
        // Koowa's CSRF authenticator checks if the framework is loaded.
        if (class_exists('Koowa'))
        {
            $manager = KObjectManager::getInstance();

            $request = $manager->getInstance()->getObject('com:koowa.dispatcher.request');
            $user    = $manager->getInstance()->getObject('user');
            $token   = $user->getSession()->getToken();

            $request->setReferrer(JUri::root());
            $request->getHeaders()->add(array('X-Xsrf-Token' => $token));
            $request->getCookies()->add(array('csrf_token' => $token));
        }

        return true;
    }
protected function _login($username, $password, $application)
    {
        // If we did receive the user credentials from the user, try to login
        if($application->login(array('username' => $username, 'password' => $password)) !== true) {
            return false;
        }

        // If we have logged in succesfully, make sure to fullfil
        // Koowa's CSRF authenticator checks if the framework is loaded.
        if (class_exists('Koowa'))
        {
            $manager = KObjectManager::getInstance();

            $request = $manager->getInstance()->getObject('com:koowa.dispatcher.request');
            $user    = $manager->getInstance()->getObject('user');
            $token   = $user->getSession()->getToken();

            $request->setReferrer(JUri::root());
            $request->getHeaders()->add(array('X-Xsrf-Token' => $token));
            $request->getCookies()->add(array('csrf_token' => $token));
        }

        return true;
    }
protected function _login ( $ username , $ password , $ application ) { // If we did receive the user credentials from the user, try to login if ( $ application -> login ( array ( 'username' => $ username , 'password' => $ password ) ) !== true ) { return false ; } // If we have logged in succesfully, make sure to fullfil // Koowa's CSRF authenticator checks if the framework is loaded. if ( class_exists ( 'Koowa' ) ) { $ manager = KObjectManager :: getInstance ( ) ; $ request = $ manager -> getInstance ( ) -> getObject ( 'com:koowa.dispatcher.request' ) ; $ user = $ manager -> getInstance ( ) -> getObject ( 'user' ) ; $ token = $ user -> getSession ( ) -> getToken ( ) ; $ request -> setReferrer ( JUri :: root ( ) ) ; $ request -> getHeaders ( ) -> add ( array ( 'X-Xsrf-Token' => $ token ) ) ; $ request -> getCookies ( ) -> add ( array ( 'csrf_token' => $ token ) ) ; } return true ; }
Logs in a given user to an application.

@param string $username    The username.
@param string $password    The password.
@param object $application The application.

@return bool True if login was successful, false otherwise.
Logs in a given user to an application .