php - CakePHP edit user gives validationErrror -


i using cakephp application, have user model. user has password, has regex validate. regex forces user use password @ least 6 characters long, containing @ least 1 number , special char.

the validation looks this:

'password' => array(      'rulename' => array(      'rule' => array('custom', '/^.*(?=.{6,})(?=.*\d)(?=.*[a-za-z])(?=.*[@#$%^&+=]).*$/i'),             'message' => 'password not legit',             'allowempty' => true      ) ) 

when want edit password, validation works great. when want edit user (no option change password there), $this->user->save() fails.

if debug $this->user->validationerrors, thing shown is:

array(     'password' => '*****' ) 

the password field not set in post data, validation should not happen @ all. when comment block of validation code, user can saved.

anyone knows doing wrong?

i solved myself already. before saving user object, did $this->user->read(null, $userid) other purposes.

this resulted in remembering values of read (including password) in $this->user object.

since save method called on $this->user object, password value trying saved too. since *** isn't valid according regex, save fails.

thanks anyway!


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -