Previously, in CakePHP 2.0. I am able to access the tokenid inside the 'if it a post condition' after I hit the submit button. Apparently now, after I hit the submit button in CakePHP 3.0, I am no longer able to receive the tokenid in the 'if it a post condition'. How can I continue to access the URL parameter inside the 'if it a post condition'? I know, it is really something simple. Can anyone enlighten me? What am I missing?
URL
/users/reset/15d3a535ecdd4ec705378b146ef572cf5bb9bfc2
Controller
public function reset($token=null) {
if ($token) { //I am able to get the tokenid here.
Debugger::Dump($this->request->pass[0]); //I am able to get the tokenid here.
Debugger::Dump($this->request->params['pass'][0]); //I am able to get the tokenid here.
if ($this->request->is(['post'])) {
Debugger::Dump($token) //I am no longer able to get the tokenid.
Debugger::Dump($this->request->pass[0]); //I am no longer able to get the tokenid.
Debugger::Dump($this->request->params['pass'][0]); //I am no longer able to get the tokenid.
}
}
}
View
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users', 'action' => 'reset']]); ?>
<?php echo $this->Form->input('password'); ?>
<?php echo $this->Form->button('Submit', ['type' => 'submit']); ?>
<?php echo $this->Form->end() ?>
After Ofir feedback,
I added the below inside the form.
<?php echo $this->Form->input('resetToken', array('type'=> 'hidden','value'=>$this->request->pass[0])); ?>