Ver Mensaje Individual
  #5 (permalink)  
Antiguo 25/08/2011, 12:36
Avatar de ApipeMc
ApipeMc
 
Fecha de Ingreso: septiembre-2010
Ubicación: Medellín, Antioquia, Colombia
Mensajes: 76
Antigüedad: 13 años, 7 meses
Puntos: 1
Respuesta: problemas al devolver Isvalid de un Zend_Form

Si quite la parte de la redirección. En el controlador.

Código PHP:
Ver original
  1. class SecurityController extends Zend_Controller_Action
  2. {
  3.  
  4.     public function init()
  5.     {
  6.         /* Initialize action controller here */
  7.     }
  8.  
  9.     public function indexAction()
  10.     {
  11.         // action index
  12.     }
  13.      
  14.     public function loginAction()
  15.     {    
  16.        
  17.         $request = $this->getRequest();
  18.         if (!$request->isPost()) {
  19.             return $this->_helper->redirector('index','index');
  20.         }
  21.        
  22.         $form = new Application_Form_LoginForm();
  23.         if(!$form->isValid($request->getPost())) {
  24.             $this->view->form = $form;
  25.             $this->renderScript('index/index.phtml');
  26.             return;
  27.         }
  28.        
  29.         $modelSecurity = new Application_Model_Security();
  30.        
  31.         $username = $this->_getParam('username');
  32.         $password = $this->_getParam('password');
  33.        
  34.         if($modelSecurity->validarUsuario($username, $password)):
  35.             return $this->_helper->redirector(index, user);
  36.         endif;
  37.            
  38.         return $this->_helper->redirector('index','index');
  39.     }
  40.    
  41.     public function logoutAction()
  42.     {
  43.         Zend_Auth::getInstance()->clearIdentity();
  44.         $this->_helper->redirector('index','index'); // back to login page
  45.     }
  46.        
  47. }