data validation problem with multiple parameters

2009-03-25 Thread dubiousandrew

I have an edit form that takes in two parameters, an id of the user
and user password.  It is designed for the first time log in so the
user is forced to create a password after following a link (that
contains the automatically generated password and their id).

For example:   example.com/user/resetPassword/45/password

(where the user id is '45' and the password is 'password')

If I enter an invalid password on the form, then it does validate it
correctly and displays the error message but the new address becomes:
example.com/user/resetPassword/45
and it truncates the password parameter and then it no longer
functions like it should.

Can some one help me please?

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: data validation problem with multiple parameters

2009-03-25 Thread mscdex

On Mar 25, 3:41 pm, dubiousandrew dubiousand...@gmail.com wrote:
 If I enter an invalid password on the form, then it does validate it
 correctly and displays the error message but the new address becomes:
 example.com/user/resetPassword/45
 and it truncates the password parameter and then it no longer
 functions like it should.

Just a guess, but are you passing the auto-generated password to the
view when validation fails, so that it can be used in your form's
action attribute when re-POSTing another attempt at a new password?
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: data validation problem with multiple parameters

2009-03-25 Thread dubiousandrew

 Just a guess, but are you passing the auto-generated password to the
 view when validation fails, so that it can be used in your form's
 action attribute when re-POSTing another attempt at a new password?

I don't think so.  I am not doing anything.  I am new to cakePHP.  How
do I do that?  here is the section of my resetPassword method that is
used:

if(!empty($this-data))
{
$this-Person-set($this-data);
if($this-Person-validates())
{
$this-Person-saveField('has_reset_password', '1');
$this-Person-saveField('password', $this-data
['Person']['password']);
$this-Session-setFlash(__('Password has been saved',
true));
$this-redirect(array('action'='index'));
}
}

As you can see, if the data isnt valid, it drops out of this section
of code, and in fact, out of the method.  When this happens, the page
redisplays which fields are invalid but the address no longer contains
the password.  I am guessing this is some auto feature of cakePHP.
How do I make sure my view gets both parameters after validating the
data?
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---