0
我正在使用cakephp 2.1,我試圖通過用戶在忘記密碼請求時將收到的鏈接更改用戶的密碼。Cakephp密碼更改不起作用
鏈接看起來是這樣的
../myApp/users/change_password/1
我傳遞的用戶ID的鏈接。即如上所述1。
的觀點即,change_password.ctp是如下
<?php echo $this->Form->create('User', array('controller' => 'users', 'action' => 'change_password', 'class' => 'well')); ?>
<?php echo $this->Form->input('User.id',array('value' => $this->params['pass'][0],'type'=>'hidden')); ?>
<?php echo $this->Form->label('password', 'Password', array('class' => 'control-label')); ?>
<?php echo $this->Form->password('password', array('class' => 'span3', 'type' => 'password')); ?>
<?php echo $this->Form->error('password', null , array('wrap' => 'span', 'class' => 'help-inline')); ?>
<?php echo $this->Form->submit('Change Password', array('class' => 'btn')); ?>
<?php echo $this->Form->end(); ?>
而且控制器如下
public function change_password() {
if($this->request->is('post')) {
if ($this->User->save($this->request->data)) {
$this->Session->setFlash('Password has been changed.', 'default/flash_success');
$this->redirect(array('controller' => 'movies', 'action' => 'index'));
} else {
$this->Session->setFlash('Password could not be changed.', 'default/flash_error');
$this->redirect(array('controller' => 'movies', 'action' => 'index'));
}
}
}
但我不能夠保存密碼。