Foros del Web » Programando para Internet » PHP » Zend »

ayuda con Zend_Auth

Estas en el tema de ayuda con Zend_Auth en el foro de Zend en Foros del Web. hola estoy intentando utilizar la clase para autentifiacion de Zend esto es lo que tengo. Código: <?php class AuthenticationController extends Zend_Controller_Action { public function init() ...
  #1 (permalink)  
Antiguo 26/07/2010, 11:08
Avatar de RIVERMILLOS  
Fecha de Ingreso: marzo-2010
Mensajes: 1.336
Antigüedad: 14 años, 1 mes
Puntos: 15
ayuda con Zend_Auth

hola estoy intentando utilizar la clase para autentifiacion de Zend esto es lo que tengo.

Código:
<?php

class AuthenticationController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
    
    }

    public function loginAction()
    {
     $authAdapter= $this->getAuthAdapter();
	 $username='rob';
	 $password='rob';
	 
	$authAdapter->setIdentity($username)
	            ->setCredential($password);
	$auth=Zend_Auth::getInstance();
	$result=$auth->authenticate($authAdapter);
	
	if($result->isValid()){
	echo 'valid';	
	}else{
    echo 'invalid';	  
    }
				 
				 
	 
    }

    public function logoutAction()
    {
       echo "hola";
    }

    private function getAuthAdapter(){
	

    $authAdapter= new  Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
	 $authAdapter->setTableName('users')
	             ->setIdentityColumn('username')
				 ->setCredentialColumn('password');
				 
	return $authAdapter;
	}
     

}
pero cuando voy a ver en el navegador me sale

An error occurred
Application error


no me dice nada que puedo tener mal.

saludos
  #2 (permalink)  
Antiguo 26/07/2010, 12:00
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: ayuda con Zend_Auth

Revisa en tu .htaccess que tengas el environment como Development así te indica todo el error completo.

Saludos.
  #3 (permalink)  
Antiguo 26/07/2010, 12:08
Avatar de RIVERMILLOS  
Fecha de Ingreso: marzo-2010
Mensajes: 1.336
Antigüedad: 14 años, 1 mes
Puntos: 15
Respuesta: ayuda con Zend_Auth

hola pero mi htacces solo tiene esto

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

saludos
  #4 (permalink)  
Antiguo 26/07/2010, 13:02
Avatar de RIVERMILLOS  
Fecha de Ingreso: marzo-2010
Mensajes: 1.336
Antigüedad: 14 años, 1 mes
Puntos: 15
Respuesta: ayuda con Zend_Auth

o te refieress al .ini este lo tengo asi

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

; Database

resources.db.adapter = "Pdo_Mysql"
resources.db.params.charset = "utf8"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "toor"
resources.db.params.dbname = "dbadapter"


[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1


saludos
  #5 (permalink)  
Antiguo 26/07/2010, 14:06
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: ayuda con Zend_Auth

Agrega una línea en tu .htaccess que diga esto: SetEnv APPLICATION_ENV development

Saludos.
  #6 (permalink)  
Antiguo 26/07/2010, 14:10
Avatar de RIVERMILLOS  
Fecha de Ingreso: marzo-2010
Mensajes: 1.336
Antigüedad: 14 años, 1 mes
Puntos: 15
Respuesta: ayuda con Zend_Auth

Listo ya pude me sale el siguiete error..

Código:
An error occurred
Application error
Exception information:

Message: No database adapter present
Stack trace:

#0 C:\xampp\php\PEAR\Zend\Auth\Adapter\DbTable.php(131): Zend_Auth_Adapter_DbTable->_setDbAdapter(NULL)
#1 C:\xampp\htdocs\Login\application\controllers\AuthenticationController.php(42): Zend_Auth_Adapter_DbTable->__construct(NULL)
#2 C:\xampp\htdocs\Login\application\controllers\AuthenticationController.php(18): AuthenticationController->getAuthAdapter()
#3 C:\xampp\php\PEAR\Zend\Controller\Action.php(513): AuthenticationController->loginAction()
#4 C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php(295): Zend_Controller_Action->dispatch('loginAction')
#5 C:\xampp\php\PEAR\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 C:\xampp\php\PEAR\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#7 C:\xampp\php\PEAR\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#8 C:\xampp\htdocs\Login\public\index.php(27): Zend_Application->run()
#9 {main}  

Request Parameters:

array (
  'controller' => 'authentication',
  'action' => 'login',
  'module' => 'default',
)

saludos
  #7 (permalink)  
Antiguo 26/07/2010, 14:12
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: ayuda con Zend_Auth

Pues ahí esta tu error, no haz configurado ningún database adapter, y por lo que veo en tu .ini tienes uno pero solo para testing, muevelo a la sección de production y ya debe de funcionar.

Saludos.
  #8 (permalink)  
Antiguo 26/07/2010, 14:33
Avatar de RIVERMILLOS  
Fecha de Ingreso: marzo-2010
Mensajes: 1.336
Antigüedad: 14 años, 1 mes
Puntos: 15
Respuesta: ayuda con Zend_Auth

Muchas gracias era eso ya se puede dar por solucionado.


saludos

Etiquetas: php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:31.