protected function _actionRead(AnCommandContext $context)
    {
        if (!$this->getAPI()) {
            $context->response->setRedirect(route('option=com_people&view=session'));
            return false;
        }
        
        $service = $this->getAPI()->getName();
        $profileId = $this->getAPI()->getUser()->id;
        $token = $this->getService('repos:connect.session')
                      ->find(array(
                          'profileId' => $profileId, 
                          'api' => $service
                      ));
                      
        $return_url = AnRequest::get('session.return', 'raw');

        if ($token) {
            $person = $token->owner;
            AnRequest::set('session.oauth', null);

            $credentials = array(
                'username' => $person->username,
                'password' => get_hash('COM_CONNECT_PASSWORD')
            );

            if ($this->getService('com:people.helper.person')->login($credentials)) {
                $context->response->setRedirect(base64_decode($return_url));
            }

            return false;
        }

        $this->return_url = base64_encode($return_url);
    }
protected function _actionRead(AnCommandContext $context)
    {
        if (!$this->getAPI()) {
            $context->response->setRedirect(route('option=com_people&view=session'));
            return false;
        }
        
        $service = $this->getAPI()->getName();
        $profileId = $this->getAPI()->getUser()->id;
        $token = $this->getService('repos:connect.session')
                      ->find(array(
                          'profileId' => $profileId, 
                          'api' => $service
                      ));
                      
        $return_url = AnRequest::get('session.return', 'raw');

        if ($token) {
            $person = $token->owner;
            AnRequest::set('session.oauth', null);

            $credentials = array(
                'username' => $person->username,
                'password' => get_hash('COM_CONNECT_PASSWORD')
            );

            if ($this->getService('com:people.helper.person')->login($credentials)) {
                $context->response->setRedirect(base64_decode($return_url));
            }

            return false;
        }

        $this->return_url = base64_encode($return_url);
    }
protected function _actionRead ( AnCommandContext $ context ) { if ( ! $ this -> getAPI ( ) ) { $ context -> response -> setRedirect ( route ( 'option=com_people&view=session' ) ) ; return false ; } $ service = $ this -> getAPI ( ) -> getName ( ) ; $ profileId = $ this -> getAPI ( ) -> getUser ( ) -> id ; $ token = $ this -> getService ( 'repos:connect.session' ) -> find ( array ( 'profileId' => $ profileId , 'api' => $ service ) ) ; $ return_url = AnRequest :: get ( 'session.return' , 'raw' ) ; if ( $ token ) { $ person = $ token -> owner ; AnRequest :: set ( 'session.oauth' , null ) ; $ credentials = array ( 'username' => $ person -> username , 'password' => get_hash ( 'COM_CONNECT_PASSWORD' ) ) ; if ( $ this -> getService ( 'com:people.helper.person' ) -> login ( $ credentials ) ) { $ context -> response -> setRedirect ( base64_decode ( $ return_url ) ) ; } return false ; } $ this -> return_url = base64_encode ( $ return_url ) ; }
Redners the login form.
Redners the login form .