|
|
|
@ -1193,7 +1193,20 @@ function rcmail_log_login()
|
|
|
|
|
if (!$RCMAIL->config->get('log_logins') || !$RCMAIL->user)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
write_log('userlogins', sprintf('Successful login for %s (ID: %d) from %s',
|
|
|
|
|
$RCMAIL->user->get_username(), $RCMAIL->user->ID, rcmail_remote_ip()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns remote IP address and forwarded addresses if found
|
|
|
|
|
*
|
|
|
|
|
* @return string Remote IP address(es)
|
|
|
|
|
*/
|
|
|
|
|
function rcmail_remote_ip()
|
|
|
|
|
{
|
|
|
|
|
$address = $_SERVER['REMOTE_ADDR'];
|
|
|
|
|
|
|
|
|
|
// append the NGINX X-Real-IP header, if set
|
|
|
|
|
if (!empty($_SERVER['HTTP_X_REAL_IP'])) {
|
|
|
|
|
$remote_ip[] = 'X-Real-IP: ' . $_SERVER['HTTP_X_REAL_IP'];
|
|
|
|
@ -1206,8 +1219,7 @@ function rcmail_log_login()
|
|
|
|
|
if (!empty($remote_ip))
|
|
|
|
|
$address .= '(' . implode(',', $remote_ip) . ')';
|
|
|
|
|
|
|
|
|
|
write_log('userlogins', sprintf('Successful login for %s (ID: %d) from %s',
|
|
|
|
|
$RCMAIL->user->get_username(), $RCMAIL->user->ID, $address));
|
|
|
|
|
return $address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|