title: Cakephp 2.0 Authentication using email instead of username
body: <p>In my view I have:</p>
  
  <pre><code>&lt;?php
  echo $this-&gt;Form-&gt;create('User', array("controller" =&gt; "Users", "action" =&gt; "login", "method" =&gt; "post"));
  echo $this-&gt;Form-&gt;input('User.email', array("label" =&gt; false));
  echo $this-&gt;Form-&gt;input('User.password', array("label" =&gt; false, 'class' =&gt; 'password-input'));
  echo $this-&gt;Form-&gt;end(); ?&gt;
  </code></pre>
  
  <p>In my AppController:</p>
  
  <pre><code>public $components = array(
          'Session',
          'Auth'
      );
  
      function beforeFilter(){
          $this-&gt;Auth-&gt;fields = array(
              'username' =&gt; 'email',
              'password' =&gt; 'password'
          );
      }
  </code></pre>
  
  <p>In my UsersController:</p>
  
  <pre><code>function beforeFilter(){
          $this-&gt;Auth-&gt;allow('sign_up', 'login', 'logout', 'forgot_password');
          return parent::beforeFilter();
      }
  public function login() {
          if ($this-&gt;Auth-&gt;login()) {
              $this-&gt;Session-&gt;setFlash(__('Successfully logged in'), 'default', array('class' =&gt; 'success'));
              $this-&gt;redirect($this-&gt;Auth-&gt;redirect());
          } else {
              if (!empty($this-&gt;request-&gt;data)) {
                  $this-&gt;Session-&gt;setFlash(__('Username or password is incorrect'), 'default', array('class' =&gt; 'notice'));
              }
          }
      }
  </code></pre>
  
  <p>But the login is not working, what am I missing?</p>
  
  <p>Thanks.</p>