public function login()
    {
        try {

            if (!$this->hasRequestParameter('successCallback')) {
                throw new \common_exception_MissingParameter ('Internal error, please retry in few moment');
            }

            if ($this->isRequestPost()) {
                $authorizationService = $this->getServiceLocator()->get(Authorization::SERVICE_ID);

                if (!$authorizationService instanceof RequireUsername) {
                    throw new InvalidCallException('Authenticator need to be call by requireusername');
                }

                if ($authorizationService->validateLogin($this->getRequestParameter('login'))) {
                    $baseUrl = $this->getServiceLocator()
                        ->get(\common_ext_ExtensionsManager::SERVICE_ID)
                        ->getExtensionById('taoClientDiagnostic')
                        ->getConstant('BASE_URL');
                    $elements = parse_url($baseUrl);
                    $this->setCookie('login', $this->getRequestParameter('login'), null, $elements['path']);
                    $this->redirect($this->getRequestParameter('successCallback'));
                }
            }

        } catch (InvalidLoginException $e) {
            $this->setData('errorMessage', $e->getUserMessage());
        }

        $this->setData('successCallback', $this->getRequestParameter('successCallback'));
        $this->setData('client_config_url', $this->getClientConfigUrl());
        $this->setData('content-controller', 'taoClientDiagnostic/controller/Authenticator/login');
        $this->setData('content-template', 'Authenticator' . DIRECTORY_SEPARATOR . 'login.tpl');
        $this->setView('index.tpl');
    }
public function login()
    {
        try {

            if (!$this->hasRequestParameter('successCallback')) {
                throw new \common_exception_MissingParameter ('Internal error, please retry in few moment');
            }

            if ($this->isRequestPost()) {
                $authorizationService = $this->getServiceLocator()->get(Authorization::SERVICE_ID);

                if (!$authorizationService instanceof RequireUsername) {
                    throw new InvalidCallException('Authenticator need to be call by requireusername');
                }

                if ($authorizationService->validateLogin($this->getRequestParameter('login'))) {
                    $baseUrl = $this->getServiceLocator()
                        ->get(\common_ext_ExtensionsManager::SERVICE_ID)
                        ->getExtensionById('taoClientDiagnostic')
                        ->getConstant('BASE_URL');
                    $elements = parse_url($baseUrl);
                    $this->setCookie('login', $this->getRequestParameter('login'), null, $elements['path']);
                    $this->redirect($this->getRequestParameter('successCallback'));
                }
            }

        } catch (InvalidLoginException $e) {
            $this->setData('errorMessage', $e->getUserMessage());
        }

        $this->setData('successCallback', $this->getRequestParameter('successCallback'));
        $this->setData('client_config_url', $this->getClientConfigUrl());
        $this->setData('content-controller', 'taoClientDiagnostic/controller/Authenticator/login');
        $this->setData('content-template', 'Authenticator' . DIRECTORY_SEPARATOR . 'login.tpl');
        $this->setView('index.tpl');
    }
public function login ( ) { try { if ( ! $ this -> hasRequestParameter ( 'successCallback' ) ) { throw new \ common_exception_MissingParameter ( 'Internal error, please retry in few moment' ) ; } if ( $ this -> isRequestPost ( ) ) { $ authorizationService = $ this -> getServiceLocator ( ) -> get ( Authorization :: SERVICE_ID ) ; if ( ! $ authorizationService instanceof RequireUsername ) { throw new InvalidCallException ( 'Authenticator need to be call by requireusername' ) ; } if ( $ authorizationService -> validateLogin ( $ this -> getRequestParameter ( 'login' ) ) ) { $ baseUrl = $ this -> getServiceLocator ( ) -> get ( \ common_ext_ExtensionsManager :: SERVICE_ID ) -> getExtensionById ( 'taoClientDiagnostic' ) -> getConstant ( 'BASE_URL' ) ; $ elements = parse_url ( $ baseUrl ) ; $ this -> setCookie ( 'login' , $ this -> getRequestParameter ( 'login' ) , null , $ elements [ 'path' ] ) ; $ this -> redirect ( $ this -> getRequestParameter ( 'successCallback' ) ) ; } } } catch ( InvalidLoginException $ e ) { $ this -> setData ( 'errorMessage' , $ e -> getUserMessage ( ) ) ; } $ this -> setData ( 'successCallback' , $ this -> getRequestParameter ( 'successCallback' ) ) ; $ this -> setData ( 'client_config_url' , $ this -> getClientConfigUrl ( ) ) ; $ this -> setData ( 'content-controller' , 'taoClientDiagnostic/controller/Authenticator/login' ) ; $ this -> setData ( 'content-template' , 'Authenticator' . DIRECTORY_SEPARATOR . 'login.tpl' ) ; $ this -> setView ( 'index.tpl' ) ; }
Login process
Check if url successCallback is set
If login form is post valid, setcookie & redirect to successCallback
Else create LoginForm with ?errorMessage
Login process Check if url successCallback is set If login form is post valid setcookie & redirect to successCallback Else create LoginForm with ?errorMessage