Skip to content

Commit b197a94

Browse files
committed
Send fail logins to delegate always
Added another string as well
1 parent 629b140 commit b197a94

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

IPBanCore/Core/IPBan/IPBanService_Private.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ private async Task ProcessPendingFailedLogins(IReadOnlyList<IPAddressLogEvent> i
228228
if (IsWhitelisted(ipAddress))
229229
{
230230
Logger.Log(failedLogin.LogLevel, "Login failure, ignoring whitelisted ip address {0}, {1}, {2}", ipAddress, userName, source);
231+
232+
// if delegate is not null and not an external event, send the event to the delegate
233+
if (IPBanDelegate != null && !failedLogin.External)
234+
{
235+
await IPBanDelegate.LoginAttemptFailed(ipAddress, source, userName, MachineGuid, OSName, OSVersion, 0, UtcNow);
236+
}
231237
}
232238
else
233239
{

IPBanCore/Core/IPBan/IPBanService_Types.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ public enum IPAddressEventFlags
153153
/// <summary>
154154
/// Send monthly report of all ip addresses
155155
/// </summary>
156-
MonthlyReport = 128
156+
MonthlyReport = 128,
157+
158+
/// <summary>
159+
/// Successful login to web admin
160+
/// </summary>
161+
SuccessfulWebAdminLogin = 256
157162
}
158163
}

IPBanCore/IPBanResources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

IPBanCore/IPBanResources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,4 +993,7 @@
993993
<data name="IPAddressEventFlags_WeeklyReport" xml:space="preserve">
994994
<value>Weekly Report</value>
995995
</data>
996+
<data name="IPAddressEventFlags_SuccessfulWebAdminLogin" xml:space="preserve">
997+
<value>Web Admin Successful Logins</value>
998+
</data>
996999
</root>

0 commit comments

Comments
 (0)