Hello,

I just started using CakePHP and can't get the AuthComponent to accept
a valid username and password - I keep getting "Login failed. Invalid
username or password." I've set up a "users" table in my db with the
login credentials set to:

username: username
password: password

Here is my code:

models/
   user.php

<?php
class User extends AppModel {

}
?>

controllers/
   users_controller.php

<?php
class UsersController extends AppController {
        var $components = array('Auth'); // Not necessary if declared in your
app controller

    /**
     *  The AuthComponent provides the needed functionality
     *  for login, so you can leave this function blank.
     */
    function login() {
    }

    function logout() {
        $this->redirect($this->Auth->logout());
    }
}
?>

views/
   login.ctp

<?php
    if  ($session->check('Message.auth')) $session->flash('auth');
    echo $form->create('User', array('action' => 'login'));
    echo $form->input('username');
    echo $form->input('password');
    echo $form->end('Login');

                if ($session->check('Message.flash')) {
                        $session->flash();
                }
                if ($session->check('Message.auth')) {
                        $session->flash('auth');
                }


?>

mysql> select * from users;
+----+----------+----------+
| id | username | password |
+----+----------+----------+
|  1 | username | password |
+----+----------+----------+
1 row in set (0.00 sec)

Thanks for any help,

Jason
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to