Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the CakePHP password field is empty when trying to access it using $this->data?

I am implementing an authentication component, This is my registration page


create('User',array('action' => 'login'));
    echo $form->input('primary_email',array('size'=> 32));
    echo $form->input('password',array('label' => 'Password'));
    echo $form->input('remember_me',array('label' => 'Remember Me','type'=>'checkbox','checked' => 'false'));
    echo $html->link('Forgot Password','/users/forgot/');
    echo $form->end('Login'); 

    // Javascripts
    echo $javascript->link('jquery',false);
    //echo $javascript->link('jquery.validate.js',false);
    //echo $javascript->codeBlock($code, array('inline' => false)); 

?>

When I print the contents of $this->data the password field turns up empty. How can I resolve this?

When I rename password to password2 or something else it works !!! Strange

like image 336
Shiv Avatar asked Jun 06 '09 20:06

Shiv


1 Answers

this is because the Auth component removes the password from the data array (for security purposes). why would you want it to contain the password anyway? the remember me logic (which I assume you are using from the form fields) will handle logging someone in without the password.

like image 167
jmcneese Avatar answered Oct 31 '22 03:10

jmcneese