Skip to content

Commit

Permalink
Send fail logins to delegate always
Browse files Browse the repository at this point in the history
Added another string as well
  • Loading branch information
jjxtra committed Aug 30, 2022
1 parent 629b140 commit b197a94
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions IPBanCore/Core/IPBan/IPBanService_Private.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ private async Task ProcessPendingFailedLogins(IReadOnlyList<IPAddressLogEvent> i
if (IsWhitelisted(ipAddress))
{
Logger.Log(failedLogin.LogLevel, "Login failure, ignoring whitelisted ip address {0}, {1}, {2}", ipAddress, userName, source);

// if delegate is not null and not an external event, send the event to the delegate
if (IPBanDelegate != null && !failedLogin.External)
{
await IPBanDelegate.LoginAttemptFailed(ipAddress, source, userName, MachineGuid, OSName, OSVersion, 0, UtcNow);
}
}
else
{
Expand Down
7 changes: 6 additions & 1 deletion IPBanCore/Core/IPBan/IPBanService_Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ public enum IPAddressEventFlags
/// <summary>
/// Send monthly report of all ip addresses
/// </summary>
MonthlyReport = 128
MonthlyReport = 128,

/// <summary>
/// Successful login to web admin
/// </summary>
SuccessfulWebAdminLogin = 256
}
}
9 changes: 9 additions & 0 deletions IPBanCore/IPBanResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions IPBanCore/IPBanResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -993,4 +993,7 @@
<data name="IPAddressEventFlags_WeeklyReport" xml:space="preserve">
<value>Weekly Report</value>
</data>
<data name="IPAddressEventFlags_SuccessfulWebAdminLogin" xml:space="preserve">
<value>Web Admin Successful Logins</value>
</data>
</root>

0 comments on commit b197a94

Please sign in to comment.