CodeIgniter Forums
PhPass Login Password Check - Help ! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: PhPass Login Password Check - Help ! (/thread-53809.html)



PhPass Login Password Check - Help ! - El Forum - 08-09-2012

[eluser]sanguina[/eluser]
Using Phpass library to handle password hashing and am stuck at the login password check.

The official PhPass documentation suggests the following
Code:
// example 2: checking a password
$user = $this->user_model->get(123);
$hashed = $user->password;
$password = $this->input->post('password');
if ($this->phpass->check($password, $hashed))
    echo 'logged in';
else
    echo 'wrong password';

And I am doing this (simplified version):
Code:
function login($email, $password)
{
$query = $this->db->get_where( 'users', array('email' => $email));
$row = $query->row();
$hashed = $row->password;
$this->load->library('phpass');
if ($this->phpass->check($password, $hashed))  {echo 'logged in';}
        else { echo 'wrong password'}
         }

Without hashing my structure works fine but after hashing - this password check is not letting me in.

Any help would be greatly appreciated :bug:



PhPass Login Password Check - Help ! - El Forum - 08-09-2012

[eluser]Aken[/eluser]
Well what's different? Is it pulling your hashed password from the DB properly? Are you processing the submitted password at all before passing it to your login method?