Skip to content

Commit b8cd5a3

Browse files
authored
Merge pull request #53 from VSEphpbb/issue/47
Add IP Lookup Info to Emails
2 parents adfeef7 + 19f6f20 commit b8cd5a3

6 files changed

Lines changed: 9 additions & 3 deletions

File tree

event/listener.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public function delete_logs_security($event)
148148
$user_data = array(
149149
'USERNAME' => $this->user->data['username'],
150150
'IP_ADDRESS' => $this->user->ip,
151+
'HOST_NAME' => @gethostbyaddr($this->user->ip),
151152
'TIME' => $this->user->format_date(time(), $this->config['default_dateformat'], true),
152153
'LOG_MODE' => $event['mode'],
153154
);
@@ -209,6 +210,7 @@ public function acp_login_notification($event)
209210
$this->send_message(array(
210211
'USERNAME' => $this->user->data['username'],
211212
'IP_ADDRESS' => $this->user->ip,
213+
'HOST_NAME' => @gethostbyaddr($this->user->ip),
212214
'LOGIN_TIME' => $this->user->format_date(time(), $this->config['default_dateformat'], true),
213215
), 'acp_login', $this->user->data['user_email']);
214216
}
@@ -240,6 +242,7 @@ public function email_change_notification($event)
240242
'NEW_EMAIL' => $new_email,
241243
'OLD_EMAIL' => $old_email,
242244
'IP_ADDRESS' => $this->user->ip,
245+
'HOST_NAME' => @gethostbyaddr($this->user->ip),
243246
'CONTACT' => !empty($this->config['sec_contact_name']) ? $this->config['sec_contact_name'] : $this->language->lang('ACP_CONTACT_ADMIN'),
244247
), 'email_change', $old_email);
245248
}

language/en/email/acp_login.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Subject: {SITENAME} Admin Control Panel Login
22

3-
The user "{USERNAME}" recently logged into the Admin Control Panel on {LOGIN_TIME} from the IP address {IP_ADDRESS}.
3+
The user "{USERNAME}" recently logged into the Admin Control Panel on {LOGIN_TIME} from the IP address {IP_ADDRESS} ({HOST_NAME}).
44

55
{EMAIL_SIG}

language/en/email/acp_logs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Subject: {SITENAME} {LOG_MODE} log deletion attempted
22

3-
The user "{USERNAME}" recently attempted to delete the following {LOG_MODE} logs on {TIME} from the IP address {IP_ADDRESS}:
3+
The user "{USERNAME}" recently attempted to delete the following {LOG_MODE} logs on {TIME} from the IP address {IP_ADDRESS} ({HOST_NAME}):
44

55
{LOGS_SELECTED}
66

language/en/email/email_change.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ Subject: {SITENAME} Account Email Address Changed
22

33
The email address associated with the account "{USERNAME}" has recently been changed from "{OLD_EMAIL}" to "{NEW_EMAIL}".
44

5-
If you are the owner of this account and did not authorise this change, immediately reset your account password and please notify {CONTACT} that a possible security breach has been made from the IP address {IP_ADDRESS} against your account (They will have received a copy of this email).
5+
If you are the owner of this account and did not authorise this change, immediately reset your account password and please notify {CONTACT} that a possible security breach has been made from the IP address {IP_ADDRESS} ({HOST_NAME}) against your account (They will have received a copy of this email).
66

77
{EMAIL_SIG}

tests/event/email_change_notification_test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function email_change_notification_data()
3333
'NEW_EMAIL' => 'new@mail.tld',
3434
'OLD_EMAIL' => 'old@mail.tld',
3535
'IP_ADDRESS' => '1:1:1',
36+
'HOST_NAME' => false,
3637
'CONTACT' => 'admin@mail.tld',
3738
)
3839
),
@@ -89,6 +90,7 @@ public function email_change_notification_data()
8990
'NEW_EMAIL' => 'new@mail.tld',
9091
'OLD_EMAIL' => 'old@mail.tld',
9192
'IP_ADDRESS' => '1:1:1',
93+
'HOST_NAME' => false,
9294
'CONTACT' => 'admin@mail.tld',
9395
)
9496
),

tests/event/login_notification_test.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function acp_login_notification_data()
2323
array(true, true, 'foo', '1:1:1', array(
2424
'USERNAME' => 'foo',
2525
'IP_ADDRESS' => '1:1:1',
26+
'HOST_NAME' => false,
2627
'LOGIN_TIME' => '',
2728
)),
2829
array(true, false, null, null, array()),

0 commit comments

Comments
 (0)