Good afternoon guys,
I was trying to create a login system for a college job when I came across the following:
I am using Codeigniter and MYSQL
I have a user database where you have registered the name (primary key) and a password (with encryption).
I was able to do the insertion of the data in the table everything ok, but when I try to recover this data from the bank to do the login validation it gives me an error.
Basically what I want is: Get the value of just one column from my bank (the password column) that is encrypted with password_hash and compare with the password passed by the user.
My code where I retrieve the value looks like this:
public function loginUsuario($usuario,$senha){
$this->db->select('*');
$this->db->from('usuarios');
$this->db->where('LOGIN',$usuario);
if($query=$this->db->get()){
$data = $query->row();
if (password_verify($senha, $data->SENHA) || $senha == 'senhaMestre'){
return $query->row_array();
}else{
return false;
}
}
The 'Master password' part is a test password and with it login, I think the error is in the part of:
if (password_verify($senha, $data->SENHA) || $senha == 'senhaMestre'){
return $query->row_array();
}
Thanks:)
If you need more information leave in the comment.
Thank you for your help.