hello everybody...I'm newbie here
I want to ask about auth components...
I try to use it but when I login there was message "Login failed.
Invalid username or password" even my username and password are
right...
I don't know how to solve this problem..thank you so much

this is my users_controller.php :

<?php
class UsersController extends AppController {

        var $name = 'Users';

        function index() {
                $this->User->recursive = 0;
                $this->set('users', $this->paginate());
        }

        function view($id = null) {
                if (!$id) {
                        $this->Session->setFlash(__('Invalid user', true));
                        $this->redirect(array('action' => 'index'));
                }
                $this->set('user', $this->User->read(null, $id));
        }

        function add() {
                if (!empty($this->data)) {
                        $this->User->create();
                        if ($this->User->save($this->data)) {
                                $this->Session->setFlash(__('The user has been 
saved', true));
                                $this->redirect(array('action' => 'index'));
                        } else {
                                $this->Session->setFlash(__('The user could not 
be saved. Please,
try again.', true));
                        }
                }
        }

        function edit($id = null) {
                if (!$id && empty($this->data)) {
                        $this->Session->setFlash(__('Invalid user', true));
                        $this->redirect(array('action' => 'index'));
                }
                if (!empty($this->data)) {
                        if ($this->User->save($this->data)) {
                                $this->Session->setFlash(__('The user has been 
saved', true));
                                $this->redirect(array('action' => 'index'));
                        } else {
                                $this->Session->setFlash(__('The user could not 
be saved. Please,
try again.', true));
                        }
                }
                if (empty($this->data)) {
                        $this->data = $this->User->read(null, $id);
                }
        }

        function delete($id = null) {
                if (!$id) {
                        $this->Session->setFlash(__('Invalid id for user', 
true));
                        $this->redirect(array('action'=>'index'));
                }
                if ($this->User->delete($id)) {
                        $this->Session->setFlash(__('User deleted', true));
                        $this->redirect(array('action'=>'index'));
                }
                $this->Session->setFlash(__('User was not deleted', true));
                $this->redirect(array('action' => 'index'));
        }

        function login() {
        if ($this->Session->read('Auth.User')) {
                $this->Session->setFlash('You are logged in!');
                $this->redirect('/posts/index', null, false);
        }
}

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

---------------------------

this is my app_controller.php
<?php
class AppController extends Controller {
        var $components = array('Session', 'Auth');
}
?>

---------------------------
this is my users/login.ctp

<h2>Login</h2>
<?php
echo $this->Session->flash('auth');
echo $form->create('User', array('url' => array('controller' =>
'users', 'action' =>'login')));
echo $form->input('User.username');
echo $form->input('User.password');
echo $form->end('Login');
?>

------------------------------------

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to