Skip to content

Commit

Permalink
Allow to show IP address on block (fix #73)
Browse files Browse the repository at this point in the history
  • Loading branch information
codeling committed Mar 15, 2014
1 parent 9528e6d commit 5e80386
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bfstop.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ public function onAfterInitialise()
}
$message = $this->params->get('blockedMessage',
JText::_('BLOCKED_IP_MESSAGE'));

if ((bool)$this->params->get('blockedMsgShowIP', false))
{
$message .= " ".JText::sprintf('BLOCKED_CLIENT_IP', $ipaddress);
}
echo $message;
$this->myapp->close();
}
Expand Down
7 changes: 7 additions & 0 deletions bfstop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@
<field name="blockedMessage" type="text" size="40" default=""
label="BLOCKED_MESSAGE_LABEL"
description="BLOCKED_MESSAGE_DESC" />
<field name="blockedMsgShowIP" type="list" default="1"
label="BLOCKED_MSG_SHOWIP_LABEL"
description="BLOCKED_MSG_SHOWIP_DESC">
<option value="0">DISABLED</option>
<option value="1">ENABLED</option>
</field>

<field name="logLevel" type="list" default="8"
label="LOGLEVEL_LABEL"
description="LOGLEVEL_DESC">
Expand Down
1 change: 1 addition & 0 deletions language/de-DE/de-DE.plg_system_bfstop.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ X_ATTEMPTS_LEFT="Du hast noch %d Versuch(e) bevor deine IP-Adresse blockiert wir
BLOCKED_SUBJECT="%s: Fehlgeschlagene Login-Versuche"
BLOCKED_BODY="Hallo!\n\nJemand hat versucht, sich mit deinem Benutzernamen auf der Webseite '%s' einzuloggen, dafür aber ein falsches Passwort angegeben.\nDies ist so oft passiert dass die IP-Adresse von der diese Versuche ausgingen, gesperrt wurde, um Missbrauch vorzubeugen.\n\nFür den Fall dass Du das nicht selbst warst, ignoriere bitte diese Mail. Du solltest Dich weiterhin wie gewohnt einloggen können.\nSolltest du jedoch selbst für diese Versuche verantwortlich sein, und du weißt nun das Passwort wieder (du kannst alternativ auch die 'Passwort zurücksetzen'-Funktion benützen), dann kannst Du die Sperre wieder aufheben indem du auf den folgenden Link klickst:\n%s\n\nFreundliche Grüße von der automatischen Webseiten-Verwaltung!\n\nHinweis: Dies ist eine automatisiert versendete Nachricht."
PASSWORD_RESET_RECOMMENDED="Es wurde bemerkt, dass einer oder mehrere deiner Login-Versuche fehlgeschlagen sind. Bei erneuten Versuchen wirst du in Kürze gesperrt. Es wird daher empfohlen, die <a href="%1$s">Funktionalität zum Zurücksetzen des Passworts</a> zu benützen!"
BLOCKED_CLIENT_IP="Deine IP-Adresse ist: %s."
2 changes: 2 additions & 0 deletions language/de-DE/de-DE.plg_system_bfstop.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ NOTIFY_USE_PASSWORD_REMINDER_DESC="Ob und wann bei fehlgeschlagenen Logins eine
REMINDER_NOTIFY_ALWAYS="Immer anzeigen"
REMINDER_NOTIFY_1LEFT="Wenn 1 Versuch übrig"
REMINDER_NOTIFY_2LEFT="Wenn 2 Versuche übrig"
BLOCKED_MSG_SHOWIP_LABEL="IP zeigen"
BLOCKED_MSG_SHOWIP_DESC="Zeige die IP Adresse des Benutzers (wie vom Server wahrgenommen) wenn blockiert"
3 changes: 2 additions & 1 deletion language/en-GB/en-GB.plg_system_bfstop.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ BLOCKED_IP_MESSAGE="Your IP address has been blocked because there were too many
X_ATTEMPTS_LEFT="You have %d attempt(s) left before your IP address will be blocked"
BLOCKED_SUBJECT="%s: Failed login attempts"
BLOCKED_BODY="Hi!\n\nSomebody tried to log in with your username at the website '%s', but has used a wrong password.\nThis has happened so many times that the system has blocked access from the IP Address where these login attempts originated to prevent misuse.\n\nIn case it wasn't you doing these login attempts, please ignore this message. You should be able to login just as usual.\nShould you be responsible for these login attempts, and you now either know the password again or you want to use the 'Reset password' functionality, you have the chance to unblock the IP address by clicking on this link:\n%s\n\nBest regards, the automatic website management\n\nNote: This is an automatically generated message."
PASSWORD_RESET_RECOMMENDED="It was noticed that one or more of your login attempts have recently failed. Trying again, you will soon be blocked. It is therefore recommended that you use the <a href="%1$s">functionality to reset your password</a>!"
PASSWORD_RESET_RECOMMENDED="It was noticed that one or more of your login attempts have recently failed. When trying again, you will soon be blocked. It is therefore recommended that you use the <a href="%1$s">functionality to reset your password</a>!"
BLOCKED_CLIENT_IP="Your IP address is: %s."
2 changes: 2 additions & 0 deletions language/en-GB/en-GB.plg_system_bfstop.sys.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ NOTIFY_USE_PASSWORD_REMINDER_DESC="Whether and when to show a reminder about usi
REMINDER_NOTIFY_ALWAYS="Always"
REMINDER_NOTIFY_1LEFT="When 1 attempt left"
REMINDER_NOTIFY_2LEFT="When 2 attempts left"
BLOCKED_MSG_SHOWIP_LABEL="Show IP"
BLOCKED_MSG_SHOWIP_DESC="When blocked, show the user his IP address (as perceived by the server)"

0 comments on commit 5e80386

Please sign in to comment.