Cakephp with basic Auth Component
i try use cakephp with auth component and it's not work
Somebody can help me, Thank a lot.
this my code:

Controller file here

    Class UsersController extends AppController {

    var $name = 'Users';
    var $uses = array('User');
    var $viewPath = 'my_view/user';
    var $layout = 'default';
    var $helpers = array('javascript');

    function beforeFilter() {
        parent::beforeFilter();
    }

    function login() {
        $this->layout = 'login';
    }

    function logout() {
        $this->layout = 'login';
        $this->redirect($this->Auth->logout());
    }

Model File:
     Class User extends AppModel {

    var $name = 'User';
    var $useTable = 'users';
    var $belongsTo = array();
    var $validate = array(
        'username' => array(
            'rule' => 'notEmpty',
            'message' => 'Username cannot empty'
        )
    );

}

AppController File:
      var $components = array('Auth','Session');

    function beforeFilter() {
        Security::setHash("md5");
        $this->Auth->fields = array('username' => 'username', 'password' => 'password');
        $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
        //$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'index');
        $this->Auth->logoutRedirect = '/';
        $this->Auth->loginError = 'Invalid e-mail / password combination.  Please try again';
        $this->Auth->authError = "This  error shows up with the user tries to access a part of the website that is protected.";
    }

In my view:

    echo $this->Session->flash('auth');
    echo $this->Form->create('User');
    echo $this->Form->input('username');
    echo $this->Form->input('password');
    echo $this->Form->end('Login');


Code above i copy and try from Google
Thank again.
Cakephp with basic Auth Component
===

i try use cakephp with auth component and it's not work
Somebody can help me, Thank a lot.
this my code:

Controller file here

    Class UsersController extends AppController {

    var $name = 'Users';
    var $uses = array('User');
    var $viewPath = 'my_view/user';
    var $layout = 'default';
    var $helpers = array('javascript');

    function beforeFilter() {
        parent::beforeFilter();
    }

    function login() {
        $this->layout = 'login';
    }

    function logout() {
        $this->layout = 'login';
        $this->redirect($this->Auth->logout());
    }

Model File:
     Class User extends AppModel {

    var $name = 'User';
    var $useTable = 'users';
    var $belongsTo = array();
    var $validate = array(
        'username' => array(
            'rule' => 'notEmpty',
            'message' => 'Username cannot empty'
        )
    );

}

AppController File:
      var $components = array('Auth','Session');

    function beforeFilter() {
        Security::setHash("md5");
        $this->Auth->fields = array('username' => 'username', 'password' => 'password');
        $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
        //$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'index');
        $this->Auth->logoutRedirect = '/';
        $this->Auth->loginError = 'Invalid e-mail / password combination.  Please try again';
        $this->Auth->authError = "This  error shows up with the user tries to access a part of the website that is protected.";
    }

In my view:

    echo $this->Session->flash('auth');
    echo $this->Form->create('User');
    echo $this->Form->input('username');
    echo $this->Form->input('password');
    echo $this->Form->end('Login');


Code above i copy and try from Google
Thank again.