designbyfront / LDAP-Authentication-for-ExpressionEngine

An ExpressionEngine Extension that allows the authentication of users via LDAP. LDAP details are copied to the EE database before standard MySQL authentication is performed. If user is not found on LDAP, MySQL authentication will still be performed (useful for EE users not in LDAP)
http://www.designbyfront.com
30 stars 16 forks source link

No login events in CP Log #11

Open diemer opened 13 years ago

diemer commented 13 years ago

I noticed this extension isn't calling the logger function, and my Control Panel log was full of only log out events so I patched this in the login_authenticate_start function, after the $this->sync_user_details($result); line.

$query = $this->EE->db->query("SELECT member_id FROM exp_members WHERE username ='".$this->EE->db->escape_str($result['username'])."' LIMIT 0, 1");

if ($query->num_rows() > 0)
{
    foreach($query->result_array() as $row)
    {
        $this->EE->session->userdata['member_id'] = $row['member_id'];
        $this->EE->session->userdata['username'] = $this->EE->db->escape_str($result['username']);
    }
}

$this->EE->load->library('logger');
$this->EE->logger->log_action("Logged in via LDAP");