aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Users/UserManager.cs
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2020-05-23 14:53:24 -0400
committerPatrick Barron <barronpm@gmail.com>2020-05-23 14:53:24 -0400
commit99511b3be8dd63d832336c65b72d0c17efb9bc6b (patch)
tree35bd2657bc8d422f92a992e94afa9417a5050f5a /Jellyfin.Server.Implementations/Users/UserManager.cs
parente3f9aaa9c62d44854c3ea667c670d6b5a76c0254 (diff)
Fix a couple bugs
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/UserManager.cs')
-rw-r--r--Jellyfin.Server.Implementations/Users/UserManager.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs
index 23646de61..62c4b9b87 100644
--- a/Jellyfin.Server.Implementations/Users/UserManager.cs
+++ b/Jellyfin.Server.Implementations/Users/UserManager.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
@@ -617,6 +618,12 @@ namespace Jellyfin.Server.Implementations.Users
public void UpdatePolicy(Guid userId, UserPolicy policy)
{
var user = GetUserById(userId);
+ int? loginAttempts = policy.LoginAttemptsBeforeLockout switch
+ {
+ -1 => null,
+ 0 => 3,
+ _ => policy.LoginAttemptsBeforeLockout
+ };
user.MaxParentalAgeRating = policy.MaxParentalRating;
user.EnableUserPreferenceAccess = policy.EnableUserPreferenceAccess;
@@ -624,9 +631,7 @@ namespace Jellyfin.Server.Implementations.Users
user.AuthenticationProviderId = policy.AuthenticationProviderId;
user.PasswordResetProviderId = policy.PasswordResetProviderId;
user.InvalidLoginAttemptCount = policy.InvalidLoginAttemptCount;
- user.LoginAttemptsBeforeLockout = policy.LoginAttemptsBeforeLockout == -1
- ? null
- : new int?(policy.LoginAttemptsBeforeLockout);
+ user.LoginAttemptsBeforeLockout = loginAttempts;
user.SetPermission(PermissionKind.IsAdministrator, policy.IsAdministrator);
user.SetPermission(PermissionKind.IsHidden, policy.IsHidden);
user.SetPermission(PermissionKind.IsDisabled, policy.IsDisabled);