Hi all,
I just started with Auth and I have some problems. I learned about
Auth in tutorials and it seems very easy but It doesn´t work in my
application.
I create a table called 'personas' with the fields 'email' for
username and 'clave' for password. When I add a new person, the
password saved with md5 codification.
My app_controller:
class AppController extends Controller {
var $components = array('Auth');
function beforeFilter(){
$this->Auth->userModel = 'Persona';
Security::setHash("md5");
$this->Auth->fields = array('username' => 'email',
'password' => 'clave');
$this->Auth->loginAction = array('controller' =>
'personas', 'action' => 'index');
$this->Auth->allow('index','add');
$this->Auth->loginRedirect = array('controller' =>
'personas', 'action' => 'display', 'login');
$this->Auth->logoutRedirect = array('controller' =>
'personas', 'action' => 'logout');
$this->Auth->loginError = 'El email ingresado o la contraseña
no son correctos. Por favor, intentalo otra vez.';
$this->Auth->authError = 'Para entrar en la zona privada
tienes que
autenticarte';
$this->Auth->authorize = 'controller';
$this->Session->write('Auth.redirect', null);
}
function isAuthorized() {
return true;
}
}
My personas_controller.php:
function login()
{
}
function logout() {
$this->Session->setFlash("Se ha desconectado correctamente");
$this->redirect($this->Auth->logout());
}
In the views personas, I created a index.ctp:
<?php // log in
$session->flash('auth');
echo $form->create('Persona',array('action'=>'login'));
echo $form->input('email',array('label' => 'Email: '));
echo $form->input('clave',array('label' => 'Password: ','type' =>
'password'));
echo $form->end('Ingresar!');
?>
And I create the view login.ctp but when I tried to login with a
existing username and password I cannot enter.
Please I appreciate your help.
Thanks
Godbye
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---