CakePHP: Cant do Simple Login

后端 未结 2 2200
刺人心
刺人心 2021-01-17 05:45

i\'m starting to cook cake haha, everytime that i submit my form for to make the authentication, nothing happens!

This\'s my AppController

App::uses         


        
2条回答
  •  青春惊慌失措
    2021-01-17 06:31

    I think your problem is here

    public function beforeFilter()
    {       
        $this->Auth->fields = array(
                'username' => 'email',
                'password' => 'senha'
            );
    }
    

    try this

      public function beforeFilter()
        { 
        $this->Auth->authenticate = array(          
                        'Form' => array(
                            'fields' => array(
                                'username' => 'email',
                                'password' => 'senha'
                                    )
                                )
                            )
        }
    

    *@@@ UPDATE @@@@ *

    Well, at last i got the solution...i think so......

    The problem is on your View. Use this-

    Form->create('User',array('action'=>'login')); ?>
        
    Form->input('email', array('type' => 'email', 'placeholder' => 'Email', 'label' => false));?>
    Form->input('senha', array('type' => 'password', 'placeholder' => 'Senha', 'label' => false));?>
    Form->end(); ?>

提交回复
热议问题