Question about callback function - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Question about callback function (/showthread.php?tid=6952) |
Question about callback function - El Forum - 03-18-2008 [eluser]lennierb5[/eluser] Alright, I am VERY new to codeigniter but I have been playing around with the validation class, specifically with regards to logging a user in. The problem I have is when I run my check_login function it does not md5 the passwd as set in the rules, I have to manually md5 it for it to work properly. The below example DOES work but I am wondering why I cannot simply use $this->validation->passwd. With using this example I am not sure if the passwd field is going through the xss_clean (which I set to go through all post data in the config) Any advice on how to do this better or something I am missing? Thanks! Code: function check() { Question about callback function - El Forum - 03-20-2008 [eluser]Clooner[/eluser] I think check_login is called before the md5 of the password field is called. So maybe simply changing this Code: $rules['username'] = 'trim|required|callback_check_login'; Code: $rules['passwd'] = 'trim|required|md5'; Question about callback function - El Forum - 03-20-2008 [eluser]Daeli[/eluser] The Problem is when you do "md5" on field rules it saves the md5 hashed string into the post variable of the field. Later you md5-hash the already hashed string again: Code: $mdpassword = md5($this->validation->passwd); Question about callback function - El Forum - 03-20-2008 [eluser]lennierb5[/eluser] Thanks for the responses. I tried that clooner recommended and the password is still not md5'd even if I do an echo directly after the rule. I tried after the set_rules function as well with no success. Daeli, I am md5ing the password because it is not correctly applying md5 through the rules. |