logic?
Sent from my iPhone
On Oct 1, 2010, at 3:53 PM, Laura <inglauraisabel@gmail.com> wrote:
> I have been searching in google and in forums but I can't find a
> solution for my problem.
>
> I have a users table called usuarios. This is part of the controller:
>
> class UsuariosController extends AppController {
>
> var $name = 'Usuarios';
>
> function login() {
> $this->layout = 'default_login';
> }
>
> function logout() {
> $this->Session->setFlash('Logout');
> $this->redirect($this->Auth->logout());
> }
> }
>
> and this is the model:
>
> class Usuario extends AppModel {
>
> var $name = 'Usuario';
> var $primaryKey = 'usuario_id';
> var $displayField = 'nombre';
> //The Associations below have been created with all possible keys,
> those that are not needed can be removed
> var $hasMany = array(
> 'Encuesta' => array(
> 'className' => 'Encuesta',
> 'foreignKey' => 'usuario_id',
> 'dependent' => false,
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'exclusive' => '',
> 'finderQuery' => '',
> 'counterQuery' => ''
> )
> );
> function beforeSave() {
> if ($this->data['Usuario']['password']) {
> $this->data['Usuario']['password'] = md5($this-
>> data['Usuario']['password']);
> }
> return true;
> }
>
> }
>
> the appController is this:
>
> class AppController extends Controller {
>
> var $helpers = array('Html', 'Session', 'Form', 'Ajax',
> 'Javascript');
> var $components = array('Auth', 'Session');
>
> function beforeFilter() {
> Security::setHash("md5");
> $this->Auth->userModel = 'Usuarios';
> $this->Auth->allow('*');
> $this->Auth->loginError = "Usuario o clave no válidos.";
> $this->Auth->authError = "Usted no tiene permisos para
> visualizar el contenido.";
> $this->Auth->loginAction = array('admin' => false,
> 'controller' => 'usuarios', 'action' => 'login');
> $this->Auth->loginRedirect = array('controller' => 'usuarios',
> 'action' => 'index');
> $this->Auth->authorize = 'controller';
> }
>
> function isAuthorized() {
> return true;
> }
>
> }
>
> and this is the login view
>
> echo $form->create('Usuario', array('action' => 'login'));
>
> echo $form->input('username', array('label' => 'Usuario:', 'before' =>
> '<td height="28"><div align="right">',
> 'between' => '</div></td>
> <td><div align="left">', 'after' => ' </div></td>'));
> echo '</tr>';
> echo '<tr>';
> echo $form->input('password', array('label' => 'Clave:', 'before' =>
> '<td height="28"><div align="right">',
> 'between' => '</div></td>
> <td><div align="left">', 'after' => ' </div></td>'));
> echo '</tr>';
> echo '<tr><td></td><td><br><div align="left">';
> echo $form->end('Enviar');
> echo '</div></td></tr>';
> echo '<tr><td></td><td><br><div align="left">';
> echo $session->flash('auth');
> echo '</div></td></tr>';
>
>
>
> The problem is that I can`t login. When I type the username and
> password and press the login button the page just reload to the login
> page again. It doesn't appear a message of wrong password or
> something like that. Just the login page like at the beginning.
>
> I need your help please.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google
> Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this
> group at http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment