[eluser]easylancer[/eluser]
I have added in a forget password function into erkanaauth. This is as far as i got:
Code:
function forgot($condition = array(), $length)
{
$this->CI->db->select($condition[0]);
$query = $this->CI->db->getwhere('users', $condition, 1, 0);
if ($query->num_rows != 1) {
return FALSE;
} else {
/*---------- Create a New Password ----------*/
$new = '';
for( $i = 1; $i <= $length; $i++ )
{
$new .= rand( 1, 9 );
}
$data = array(
'password' => $new
);
$this->CI->db->update('users', $data, $condition);
mail($condition, "New Password", "Your new password is: " . $new);
return TRUE;
}
}
I can't seem to get the mail to work. The update function works but it won't email.