mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
Merge pull request #1127 from LogicalPhallacy/lockoutfix
Add configurable user lockout
This commit is contained in:
@@ -448,11 +448,19 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
user.Policy.InvalidLoginAttemptCount = newValue;
|
||||
|
||||
var maxCount = user.Policy.IsAdministrator ? 3 : 5;
|
||||
// Check for users without a value here and then fill in the default value
|
||||
// also protect from an always lockout if misconfigured
|
||||
if (user.Policy.LoginAttemptsBeforeLockout == null || user.Policy.LoginAttemptsBeforeLockout == 0)
|
||||
{
|
||||
user.Policy.LoginAttemptsBeforeLockout = user.Policy.IsAdministrator ? 5 : 3;
|
||||
}
|
||||
|
||||
var maxCount = user.Policy.LoginAttemptsBeforeLockout;
|
||||
|
||||
var fireLockout = false;
|
||||
|
||||
if (newValue >= maxCount)
|
||||
// -1 can be used to specify no lockout value
|
||||
if (maxCount != -1 && newValue >= maxCount)
|
||||
{
|
||||
_logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue);
|
||||
user.Policy.IsDisabled = true;
|
||||
|
||||
Reference in New Issue
Block a user