Skip to content

Commit

Permalink
If enabled, send 403 instead of 200 on block (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
codeling committed Aug 5, 2013
1 parent 497ecb8 commit 2fcffab
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bfstop.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ public function onAfterInitialise()
return;
}
JPlugin::loadLanguage('plg_system_bfstop');
if ($this->params->get('useHttpError', false))
{
header('HTTP/1.0 403 Forbidden');
}
$message = $this->params->get('blockedMessage', JText::_('BLOCKED_IP_MESSAGE'));
echo $message;
$this->myapp->close();
Expand Down
6 changes: 6 additions & 0 deletions bfstop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@
<option value="64">INFO</option>
<option value="128">DEBUG</option>
</field>
<field name="useHttpError" type="list" default="1"
label="USE_HTTP_ERROR_LABEL"
description="USE_HTTP_ERROR_DESC">
<option value="0">DISABLED</option>
<option value="1">ENABLED</option>
</field>
</fieldset>
</fields>
</config>
Expand Down
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 @@ -26,6 +26,8 @@ NOTIFY_REMAINING_ATTEMPTS_LABEL="Übrige Versuche"
NOTIFY_REMAINING_ATTEMPTS_DESC="Schaltet die Benachrichtigung über verbleibende Versuche ein; wenn aktiviert, wird im Login-Formular nach einem fehlgeschlagenen Login-Versuch eine Nachricht mit den verbleibenden Login-Versuchen angezeigt. Diese Einstellung wird nur dann berücksichtigt, wenn Sperren eingeschaltet ist (wenn es nicht eingeschaltet ist, gibt es ja auch keine 'verbleibenden' Versuche)"
NOTIFY_BLOCKED_USER_LABEL="Benutzer-Block-Nachricht"
NOTIFY_BLOCKED_USER_DESC="Wenn eingeschaltet, wird an die in der Datenbank hinterlegte Email-Adresse eine Nachricht hinterlegt, wenn eine IP-Adresse gesperrt wird (sofern der Benutzername, mit dem das Login versucht wurde, ein existierender war)"
USE_HTTP_ERROR_LABEL="Verwende HTTP-Fehler"
USE_HTTP_ERROR_DESC="Wenn aktiviert, wird der HTTP Statuscode 403 (Forbidden) gesendet wenn die IP-Addresse eines Benutzers gesperrt ist."
SELECTEDUSERS="Gewählter Benutzer"
CUSTOMEMAILADDRESS="Benutzerdefinierte Email-Adresse"
ENABLED="aktiviert"
Expand Down
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 @@ -26,6 +26,8 @@ NOTIFY_REMAINING_ATTEMPTS_LABEL="Remaining attempts"
NOTIFY_REMAINING_ATTEMPTS_DESC="Enables or disables notifications about remaining attempts; if enabled, the user will, after each failed login attempt, see a message in the login form about how many login attempts still are available before the IP address will be blocked. This setting is only active if blocking is enabled (if blocking is disabled, 'remaining' entries wouldn't make sense)."
NOTIFY_BLOCKED_USER_LABEL="User Block Message"
NOTIFY_BLOCKED_USER_DESC="When turned on, in case of a blocked IP address, a notification will be sent to the user which tried to log in (only of course in case it is an existing username)."
USE_HTTP_ERROR_LABEL="Use HTTP Error"
USE_HTTP_ERROR_DESC="If enabled, bfstop will send a status code 403 (Forbidden) if the users' IP address is blocked"
SELECTEDUSERS="Selected User"
CUSTOMEMAILADDRESS="Custom Email Address"
ENABLED="enabled"
Expand Down

0 comments on commit 2fcffab

Please sign in to comment.