Cleanup and fix more bugs

This commit is contained in:
Patrick Barron 2020-05-23 16:07:42 -04:00
parent e8173df9dc
commit e052128c52
3 changed files with 15 additions and 6 deletions

View File

@ -556,6 +556,11 @@ namespace Jellyfin.Server.Implementations.Users
_invalidAuthProvider = _authenticationProviders.OfType<InvalidAuthProvider>().First(); _invalidAuthProvider = _authenticationProviders.OfType<InvalidAuthProvider>().First();
_defaultAuthenticationProvider = _authenticationProviders.OfType<DefaultAuthenticationProvider>().First(); _defaultAuthenticationProvider = _authenticationProviders.OfType<DefaultAuthenticationProvider>().First();
_defaultPasswordResetProvider = _passwordResetProviders.OfType<DefaultPasswordResetProvider>().First(); _defaultPasswordResetProvider = _passwordResetProviders.OfType<DefaultPasswordResetProvider>().First();
if (_authenticationProviders.Length > 2)
{
_logger.LogCritical("INVALID NUMBER OF LOGGERS: {0}", _authenticationProviders.Length);
}
} }
/// <inheritdoc/> /// <inheritdoc/>
@ -616,7 +621,7 @@ namespace Jellyfin.Server.Implementations.Users
public void UpdatePolicy(Guid userId, UserPolicy policy) public void UpdatePolicy(Guid userId, UserPolicy policy)
{ {
var user = GetUserById(userId); var user = GetUserById(userId);
int? loginAttempts = policy.LoginAttemptsBeforeLockout switch int? maxLoginAttempts = policy.LoginAttemptsBeforeLockout switch
{ {
-1 => null, -1 => null,
0 => 3, 0 => 3,
@ -629,7 +634,7 @@ namespace Jellyfin.Server.Implementations.Users
user.AuthenticationProviderId = policy.AuthenticationProviderId; user.AuthenticationProviderId = policy.AuthenticationProviderId;
user.PasswordResetProviderId = policy.PasswordResetProviderId; user.PasswordResetProviderId = policy.PasswordResetProviderId;
user.InvalidLoginAttemptCount = policy.InvalidLoginAttemptCount; user.InvalidLoginAttemptCount = policy.InvalidLoginAttemptCount;
user.LoginAttemptsBeforeLockout = loginAttempts; user.LoginAttemptsBeforeLockout = maxLoginAttempts;
user.SetPermission(PermissionKind.IsAdministrator, policy.IsAdministrator); user.SetPermission(PermissionKind.IsAdministrator, policy.IsAdministrator);
user.SetPermission(PermissionKind.IsHidden, policy.IsHidden); user.SetPermission(PermissionKind.IsHidden, policy.IsHidden);
user.SetPermission(PermissionKind.IsDisabled, policy.IsDisabled); user.SetPermission(PermissionKind.IsDisabled, policy.IsDisabled);

View File

@ -85,9 +85,7 @@ namespace Jellyfin.Server
protected override IEnumerable<Assembly> GetAssembliesWithPartsInternal() protected override IEnumerable<Assembly> GetAssembliesWithPartsInternal()
{ {
yield return typeof(CoreAppHost).Assembly; yield return typeof(CoreAppHost).Assembly;
yield return typeof(DefaultAuthenticationProvider).Assembly; yield return Assembly.Load("Jellyfin.Server.Implementations");
yield return typeof(DefaultPasswordResetProvider).Assembly;
yield return typeof(InvalidAuthProvider).Assembly;
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@ -86,6 +86,12 @@ namespace Jellyfin.Server.Migrations.Routines
?? typeof(DefaultAuthenticationProvider).FullName; ?? typeof(DefaultAuthenticationProvider).FullName;
policy.PasswordResetProviderId = typeof(DefaultPasswordResetProvider).FullName; policy.PasswordResetProviderId = typeof(DefaultPasswordResetProvider).FullName;
int? maxLoginAttempts = policy.LoginAttemptsBeforeLockout switch
{
-1 => null,
0 => 3,
_ => policy.LoginAttemptsBeforeLockout
};
var user = new User(mockup.Name, policy.AuthenticationProviderId, policy.PasswordResetProviderId) var user = new User(mockup.Name, policy.AuthenticationProviderId, policy.PasswordResetProviderId)
{ {
@ -95,7 +101,7 @@ namespace Jellyfin.Server.Migrations.Routines
EnableUserPreferenceAccess = policy.EnableUserPreferenceAccess, EnableUserPreferenceAccess = policy.EnableUserPreferenceAccess,
RemoteClientBitrateLimit = policy.RemoteClientBitrateLimit, RemoteClientBitrateLimit = policy.RemoteClientBitrateLimit,
InvalidLoginAttemptCount = policy.InvalidLoginAttemptCount, InvalidLoginAttemptCount = policy.InvalidLoginAttemptCount,
LoginAttemptsBeforeLockout = policy.LoginAttemptsBeforeLockout == -1 ? null : new int?(policy.LoginAttemptsBeforeLockout), LoginAttemptsBeforeLockout = maxLoginAttempts,
SubtitleMode = config.SubtitleMode, SubtitleMode = config.SubtitleMode,
HidePlayedInLatest = config.HidePlayedInLatest, HidePlayedInLatest = config.HidePlayedInLatest,
EnableLocalPassword = config.EnableLocalPassword, EnableLocalPassword = config.EnableLocalPassword,