/**
  * Metodo para validar acceso al portal
  * @return \Zend\View\Model\ViewModel
  */
 public function ingresoAction()
 {
     if ($this->getRequest()->isPost()) {
         $auth = new AuthenticationService();
         $validate = $this->getRequest()->getPost();
         $authAdapter = new AuthAdapter($this->adapter(), 'usuario', 'usuario_correo', 'usuario_password');
         $authAdapter->setIdentity($validate['correo']);
         $authAdapter->setCredential(md5($validate['password']));
         $resultado = $auth->authenticate($authAdapter);
         switch ($resultado->getCode()) {
             case Result::FAILURE_IDENTITY_NOT_FOUND:
                 $this->message = "Usuario y/o contraseña incorrectos";
                 $this->flashMessenger()->addMessage($this->message);
                 return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/login');
             case Result::FAILURE_CREDENTIAL_INVALID:
                 $this->message = "Usuario y/o contraseña incorrectos";
                 $this->flashMessenger()->addMessage($this->message);
                 return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/login');
             case Result::SUCCESS:
                 $this->flashMessenger()->clearMessages();
                 $store = $auth->getStorage();
                 $store->write($authAdapter->getResultRowObject(null, 'usuario_password'));
                 $sessionConfig = new StandardConfig();
                 $sessionConfig->setRememberMeSeconds(20)->setCookieLifetime(30)->setCookieSecure(true)->setGcMaxlifetime(60)->setGcDivisor(60);
                 $sesionMa = new SessionManager($sessionConfig);
                 $sesionMa->rememberMe(30);
                 $container = new Container('cbol');
                 $container->setExpirationSeconds(1800);
                 $sesionMa->start();
                 $container->idSession = $auth->getIdentity()->perfil_id;
                 $permisos = $this->getPermisos($auth->getIdentity()->usuario_id);
                 $container->permisosUser = $permisos;
                 $indexProfile = \Login\IndexAllProfile::listIndexAllProfiles($auth->getIdentity()->perfil_id);
                 if ($indexProfile == 'vias') {
                     $container->reportesVias = $this->getReportesViales();
                 }
                 if ($indexProfile == 'admin') {
                     $container->sugerencias = $this->getSugerenciasAction();
                 }
                 $container->setDefaultManager($sesionMa);
                 return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . "/{$indexProfile}");
             default:
                 echo 'Mensaje por defecto';
                 break;
         }
     }
 }
 public function testSettingInvalidRememberMeSecondsRaisesException2()
 {
     $this->setExpectedException('Zend\Session\Exception\InvalidArgumentException',
                                 'Invalid remember_me_seconds; must be a positive integer');
     $this->config->setRememberMeSeconds(-1);
 }