> In registration form I want to add "confirm password" filed.
> I don't have this filed in my users table.
Why would you add it to your model? You probably don't want to save
it, but instead compare it to the password field to make sure they are
the same. Assuming the task you have in mind is to create a new user
and you want to make sure the password was entered correctly, do the
following:
In your view (add_user.ctp), just create the input using something
like
<?php echo $form->create('User', array('action' => 'add_user'))?>
.
.
<?php echo $html->input("Password") ?>
<?php echo $html->input("Confirm Password") ?>
.
.
Then in the controller action for that view (add_user), the contents
of the user input
can be compared like:
if ($this->data['User']['Password'] == $this->Auth->password($this-
>data['User']['Password Confirm'])) {
$this->User->create();
$this->User->save($this->data);
}
else {
$this->Session->setFlash(__('Passwords do not match', true));
$this->redirect(array('action'=>'add_user'));
}
I hope this helps,
Ken
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment