Wednesday, June 18, 2014

My $this->Auth->login() does not work, any help please? :) Cakephp 2.5.1

Hi all, 

I use cakephp 2.5.1 and my  $this->Auth->login()   does not work. It return me "false" each time.
Maybe if someone can say me why , i ll be very gratefull ^^
I m on this problem for severals days T_T

My DB is called  users and there are fields "username" and "password" .

AppControler

1
2
3
4
5
6
7
8
9
10
11
12
class AppController extends Controller {
 
    public $components = array('Session', 'Cookie',       
        'Auth' => array(
            'authenticate' => array('Form')
            ));
             
    public function beforeFilter() {
        parent::beforeFilter();
    }             
     
}


UsersController

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public function login() {
 
    if(!empty ($this->request->data)){
        if($this->Auth->login()){
            die('logged');
        }else{
                                
        }
        debug($this->request->data);
        debug($this->Auth->login());
         
    }
         
   }


It's my debug

array(
'User' => array(
'username ' => 'monidentifiant',
'password ' => 'monpassword'
)
)

 debug for Auth   =>  False

the view

login.ctp

nothing to very special...
1
2
3
4
<?= $this->Form->create('User') ;?>
<?= $this->Form->input('username ', array('label' => 'username', 'placeholder' => "Identifiant")); ?>
<?= $this->Form->input('password ', array('label' => 'password', 'placeholder' => "Mot de passe", 'type' => 'password')); ?>
<?= $this->Form->end('se connecter') ;?>  .




--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: