designbyfront/LDAP-Authentication-for-ExpressionEngine

No login events in CP Log

Opened this issue · 0 comments

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");