Browse Source

Merge pull request #6 from killfall/password_hash

Moved password hashing to separate function
develop
Emre Akay 11 years ago
parent
commit
cf1ef61621
  1. 21
      application/libraries/Aauth.php

21
application/libraries/Aauth.php

@ -71,6 +71,17 @@ class Aauth {
$this->config_vars = & $this->CI->config->item('aauth'); $this->config_vars = & $this->CI->config->item('aauth');
} }
/**
* Hash password
* Hash the password for storage in the database
* @param string $pass Password to hash
* @return string Hashed password
*/
function hash_password($pass) {
return md5($pass);
}
######################## ########################
# User Functions # User Functions
######################## ########################
@ -125,8 +136,8 @@ class Aauth {
$query = null; $query = null;
$query = $this->CI->db->where('email', $email); $query = $this->CI->db->where('email', $email);
// Database stores pasword md5 cripted // Database stores pasword hashed password
$query = $this->CI->db->where('pass', md5($pass)); $query = $this->CI->db->where('pass', hash_password($pass));
$query = $this->CI->db->where('banned', 0); $query = $this->CI->db->where('banned', 0);
$query = $this->CI->db->get($this->config_vars['users']); $query = $this->CI->db->get($this->config_vars['users']);
@ -382,7 +393,7 @@ class Aauth {
$data = array( $data = array(
'email' => $email, 'email' => $email,
'pass' => md5($pass), 'pass' => hash_password($pass),
'name' => $name, 'name' => $name,
); );
@ -427,7 +438,7 @@ class Aauth {
} }
if ($pass != FALSE) { if ($pass != FALSE) {
$data['pass'] = md5($pass); $data['pass'] = hash_password($pass);
} }
if ($name != FALSE) { if ($name != FALSE) {
@ -638,7 +649,7 @@ class Aauth {
$data = array( $data = array(
'verification_code' => '', 'verification_code' => '',
'pass' => md5($pass) 'pass' => hash_password($pass)
); );
$row = $query->row(); $row = $query->row();

Loading…
Cancel
Save