[eluser]USCTrojans[/eluser]
Hello, I keep running into problems getting acquainted with code igniter and this forum has been great, I appreciate the help.
For some reason sha1 security is not working properly for me while I try to validate information to log users in. I have a login controller and a creation controller but for some reason when I use sha1 the login controller will not validate. However, when I use md5 it works perfect.
Here's my login model
Code:
class Login_model extends CI_Model {
function __construct()
{
parent::__construct();
$this->load->library('encrypt');
}
function validate()
{
$this->db->where('email_address', $this->input->post('email_address'));
$this->db->where('password', md5($this->input->post('password')));
$validated_login_credentials = $this->db->get('user_credentials');
if($validated_login_credentials->num_rows == 1)
{
return $validated_login_credentials->row_array();
return true;
}
}
and here's my profile creation controller
Code:
<?php
class Create_profile_model extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->library('encrypt');
}
function validate_creation()
{
$new_user_credentials = array(
'first_name' => $this->input->post('create_first_name'),
'last_name' => $this->input->post('create_last_name'),
'email_address' => $this->input->post('create_email_address'),
'password' => md5($this->input->post('create_password')),
);
$this->db->where('email_address', $this->input->post('create_email_address'));
$validated_creation_credentials = $this->db->get('user_credentials');
if ($validated_creation_credentials->num_rows !==0)
{
return false;
}
else
{
$insert = $this->db->insert('user_credentials', $new_user_credentials);
return $insert;
}
}
}
?>
this works great right now but if i go and replace the sha1 it kills the login. the create user controller works fine...any ideas what may be going on? I have a 32 character encryption key set in config.php
thanks