title: Cakephp not allowing login with any authentication
body: <p>I'm attempting to use cakephp for the first time and the code I've written isn't allowing for me to log any users in. The creation of users works just fine as I was able to query my database and output the username and hashed password. I'm not sure if I'm just missing a line of code somewhere or if I perhaps am not making the password field in my database large enough. I have fiddled with my database variables but altering the size and type both don't seem to help. </p>
  
  <p>AppController:</p>
  
  <pre><code>class AppController extends Controller 
  {
  public $helpers = array('Html');
  
  public $components = array(
      'Session',
      'Auth' =&gt; array(
          'loginRedirect' =&gt; array(
              'controller' =&gt; 'login',
              'action' =&gt; 'index'
          ),
          'logoutRedirect' =&gt; array(
              'controller' =&gt; 'home', 
              'action' =&gt; 'index', 'home'
          ),
          'Auth' =&gt; array('authorize' =&gt; 'Controller'),
          'authenticate' =&gt; array(
              'Form' =&gt; array('passwordHasher' =&gt; 'Blowfish')
          )
      )
  );
  
  public function beforeFilter()
  {
      $this-&gt;Auth-&gt;allow('index', 'view');
      $this-&gt;set('loggedin', $this-&gt;Auth-&gt;loggedIn());
  }
  
  public function isAuthorized($user)
  {
      if(($this-&gt;Auth-&gt;user('id')) === $user['user_id'])
      {
          return true;
      }
      else
      {
          $this-&gt;Session-&gt;setFlash(__('Please log in to view this page'));
          return false;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My UsersController:</p>
  
  <pre><code>class UsersController extends AppController
  {
  public $helpers = array('HTML', 'Form');
  
  public function beforeFilter()
  {
      parent::beforeFilter();
      $this-&gt;Auth-&gt;allow('add');
  }
  
  public function index()
  {
      $this-&gt;set('users', $this-&gt;User-&gt;find('all'));
  }
  
  public function add()
  {
      if($this-&gt;request-&gt;is('post'))
      {
          $this-&gt;User-&gt;create();
  
          if($this-&gt;User-&gt;save($this-&gt;data))
          {
              $this-&gt;Session-&gt;setFlash(__('Created new user'));
              return $this-&gt;redirect(array('controller' =&gt; 'users', 'action' =&gt; 'login'));
          }
          $this-&gt;Session-&gt;setFlash(__('Could not create new user. Please try again.'));
      }
  }
  
  public function login()
  {
      //$this-&gt;set('allUsers', $this-&gt;User-&gt;query("SELECT `User`.`user_id`, `User`.`username`, 
      //`User`.`password` FROM `ead44db`.`users` AS `User` WHERE 1 = 1"));
  
      if($this-&gt;request-&gt;is('post'))
      {
          if($this-&gt;Auth-&gt;login())
          {
              return $this-&gt;redirect($this-&gt;Auth-&gt;redirect());
          }
          $this-&gt;Session-&gt;setFlash(__('Incorrect user name or password, please try again.'));
      }
  }
  
  public function logout()
  {
      return $this-&gt;redirect($this-&gt;Auth-&gt;logout());
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My User model:</p>
  
  <pre><code>&lt;?php
  
  App::uses('BlowfishPasswordHasher', 'Controller/Component/Auth');
  
  class User extends AppModel
  {
  public $validate = array('username' =&gt; array('required' =&gt; array('rule' =&gt; 'notEmpty')), 
      'password' =&gt; array('required' =&gt; array('rule' =&gt; 'notEmpty')));
  
  /*public $hasMany = array('Review' =&gt; array('className' =&gt; 'Review', 'foreignKey' =&gt; 'reviewer_id'),
      'Message' =&gt; array('className' =&gt; 'Message', 'foreignKey' =&gt; 'user_to_id'),
      'Message' =&gt; array('className' =&gt; 'Message', 'foreignKey' =&gt; 'user_from_id'),
      'Comment' =&gt; array('className' =&gt; 'Comment', 'foreignKey' =&gt; 'commenter_id'));*/
  
  public $hasMany = array('Review', 'Message', 'Comment');
  
  public function beforeSave($options = array())
  {
      if(isset($this-&gt;data['User']['password']))
      {
          $passwordHasher = new BlowfishPasswordHasher();
          $this-&gt;data['User']['password'] = $passwordHasher-&gt;hash($this-&gt;data['User']['password']);
      }
      return true;
  }
  }
  
  ?&gt;
  </code></pre>
  
  <p>And my database table for users:</p>
  
  <pre><code>CREATE TABLE users (
  user_id int AUTO_INCREMENT PRIMARY KEY,
  username varchar(50) UNIQUE,
  password TEXT NOT NULL
  );
  </code></pre>