CakePHP Post action field filter -


for security purposes, i'd filter un-allowed fields $this->request->data array.

e.g. $this->request->data looks this:

array(     'user' => array(         'password' => '*****',         'email' => 'asd@asdasd.de'     ) ) 

and want apply filter array above:

array(     'user' => array(         0 => 'password',         1 => 'email'     ) ) 

so post-data's fields not in filter-array being unset.

the reason can see make sense during register/login actions invalidation result in password being outputted again in way.

there have set empty before passing down view again:

if ($this->auth->login()) {     // flash message     return $this->redirect($this->auth->redirecturl()); } $this->request->data['user']['password'] = ''; 

see https://github.com/dereuromark/cakefest/blob/master/controller/accountcontroller.php#l26 example.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -