Example #1
0
 public function logIn($correo, $clave)
 {
     try {
         $result = null;
         if (isset($correo) && isset($clave)) {
             $auth = Zend_Auth::getInstance();
             $systema = Application_Model_System_System::getInstance();
             $result = $systema->getDbObject()->fetchRow('SELECT * FROM usuarios WHERE correo_electronico = ?', $correo);
             if (isset($result['clave'])) {
                 $adapter = new Application_Model_Autentificacion_UserAuthenticateAdapter($correo, $clave, $result);
                 $autenticado = $auth->authenticate($adapter);
                 //die('System2: ( Adapter->autenticado ) <pre>' . print_r( $autenticado,true) . '</pre>');
             }
             if ($autenticado != null) {
                 if ($autenticado->isValid() == true) {
                 } else {
                     $this->logOut();
                     $this->_response->setRedirect($this->view->baseUrl() . '/index/')->sendResponse();
                 }
             }
         }
     } catch (exception $e) {
         //$this->catchException($e);
         echo $e->getMessage();
     }
 }
 public function __construct()
 {
     $this->system = Application_Model_System_System::getInstance();
 }