title: cakePHP login fails
body: <p>I am just start coding with cakePHP. I coded around and tried to write a login and authentication page. <br/>
  I tried this:</p>
  
  <pre><code>class AppController extends Controller 
  {
      public function beforeFilter()
      {
          parent::beforeFilter();
          if ($this-&gt;request-&gt;action != 'login' &amp;&amp; !$this-&gt;Session-&gt;check('profile')) 
          {
              $this-&gt;Session-&gt;setFlash('You are not logged in');
              $this-&gt;redirect(array(
                  'controller' =&gt; 'profiles',
                  'action' =&gt; 'login'
              ));
          }
      }
  }
  </code></pre>
  
  <p>My problem is that i cannot login. I always get </p>
  
  <blockquote>
    <p>"You are not logged in"</p>
  </blockquote>
  
  <p>Without this code, it works but didn't protec the other pages.<br/>
  My routes.php<br/></p>
  
  <pre><code>Router::connect('/', array('controller' =&gt; 'profiles', 'action' =&gt; 'login'));
  </code></pre>
  
  <p>My ProfilesController.php<br/></p>
  
  <pre><code>public function login()
  {
      if ($this-&gt;request-&gt;is('post')) 
      {
          $profile = $this-&gt;Profile-&gt;find('first', array(
              'conditions' =&gt; array(
                  'name' =&gt; $this-&gt;request-&gt;data('Profile.name'),
                  'password' =&gt; $this-&gt;request-&gt;data('Profile.password')
              )
          ));
          if ($profile) 
          {
              $this-&gt;Session-&gt;write('Profile',$profile);
              $this-&gt;redirect(array('controller' =&gt; 'Projects',
                  'action' =&gt; 'index'));
          }
          $this-&gt;Session-&gt;setFlash('Profile and Password does not match!');
      }
  }
  </code></pre>