![]() |
[Solved] Cannot login with model my login function - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: [Solved] Cannot login with model my login function (/showthread.php?tid=65744) |
[Solved] Cannot login with model my login function - wolfgang1983 - 07-18-2016 I am using password password_verify for my password to check if correct. How ever I am entering the correct password but it keeps on returning false when submit form. And it is getting the secured_password from database OK. I am not sure why it keeps on returning false any suggestions? PHP Code: <?php Controller PHP Code: <?php Update: I have been trying to figure it out for some reason it does not like when I try to get my password from my database but when I hard code password in it works fine I think its some thing to do with model function any ideas? PHP Code: $username = $this->input->post('username'); PHP Code: public function secure_password($username) { RE: Cannot login with model my login function - gerney - 07-19-2016 Hello.. Is the value return by the secure_password() function is a hash password using php's password_hash() function? RE: Cannot login with model my login function - InsiteFX - 07-19-2016 Try the below and see if it works, the hash needs to be within single quotes '' PHP Code: public function secure_password($username) RE: Cannot login with model my login function - wolfgang1983 - 07-19-2016 (07-19-2016, 04:43 PM)InsiteFX Wrote: Try the below and see if it works, the hash needs to be within single quotes '' I have found the issue. When the password has was inserted into the database there was a extra blank space been added. I have now fixed that that was the issue. Thank you all for help RE: [Solved] Cannot login with model my login function - InsiteFX - 07-20-2016 Yes the password_hash() method will truncate at the first null byte so you need to be very careful with that. I think this only happens with the BCRYPT. |