diff options
Diffstat (limited to 'Jellyfin.Server.Implementations/Users')
3 files changed, 14 insertions, 14 deletions
diff --git a/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs b/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs index 7480a05c2..72f3d6e8e 100644 --- a/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs +++ b/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs @@ -41,7 +41,7 @@ namespace Jellyfin.Server.Implementations.Users // This is the version that we need to use for local users. Because reasons. public Task<ProviderAuthenticationResult> Authenticate(string username, string password, User resolvedUser) { - if (resolvedUser == null) + if (resolvedUser is null) { throw new AuthenticationException("Specified user does not exist."); } @@ -58,7 +58,7 @@ namespace Jellyfin.Server.Implementations.Users } // Handle the case when the stored password is null, but the user tried to login with a password - if (resolvedUser.Password == null) + if (resolvedUser.Password is null) { throw new AuthenticationException("Invalid username or password"); } diff --git a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs index 87babc05c..fddad1c4f 100644 --- a/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs +++ b/Jellyfin.Server.Implementations/Users/DisplayPreferencesManager.cs @@ -34,7 +34,7 @@ namespace Jellyfin.Server.Implementations.Users .FirstOrDefault(pref => pref.UserId.Equals(userId) && string.Equals(pref.Client, client) && pref.ItemId.Equals(itemId)); - if (prefs == null) + if (prefs is null) { prefs = new DisplayPreferences(userId, itemId, client); _dbContext.DisplayPreferences.Add(prefs); @@ -49,7 +49,7 @@ namespace Jellyfin.Server.Implementations.Users var prefs = _dbContext.ItemDisplayPreferences .FirstOrDefault(pref => pref.UserId.Equals(userId) && pref.ItemId.Equals(itemId) && string.Equals(pref.Client, client)); - if (prefs == null) + if (prefs is null) { prefs = new ItemDisplayPreferences(userId, Guid.Empty, client); _dbContext.ItemDisplayPreferences.Add(prefs); diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs index 25560707a..ae3fcad29 100644 --- a/Jellyfin.Server.Implementations/Users/UserManager.cs +++ b/Jellyfin.Server.Implementations/Users/UserManager.cs @@ -286,7 +286,7 @@ namespace Jellyfin.Server.Implementations.Users /// <inheritdoc/> public async Task ChangeEasyPassword(User user, string newPassword, string? newPasswordSha1) { - if (newPassword != null) + if (newPassword is not null) { newPasswordSha1 = _cryptoProvider.CreatePasswordHash(newPassword).ToString(); } @@ -317,7 +317,7 @@ namespace Jellyfin.Server.Implementations.Users EnableAutoLogin = user.EnableAutoLogin, LastLoginDate = user.LastLoginDate, LastActivityDate = user.LastActivityDate, - PrimaryImageTag = user.ProfileImage != null ? _imageProcessor.GetImageCacheTag(user) : null, + PrimaryImageTag = user.ProfileImage is not null ? _imageProcessor.GetImageCacheTag(user) : null, Configuration = new UserConfiguration { SubtitleMode = user.SubtitleMode, @@ -401,12 +401,12 @@ namespace Jellyfin.Server.Implementations.Users var authenticationProvider = authResult.AuthenticationProvider; var success = authResult.Success; - if (user == null) + if (user is null) { string updatedUsername = authResult.Username; if (success - && authenticationProvider != null + && authenticationProvider is not null && authenticationProvider is not DefaultAuthenticationProvider) { // Trust the username returned by the authentication provider @@ -416,25 +416,25 @@ namespace Jellyfin.Server.Implementations.Users // the authentication provider might have created it user = Users.FirstOrDefault(i => string.Equals(username, i.Username, StringComparison.OrdinalIgnoreCase)); - if (authenticationProvider is IHasNewUserPolicy hasNewUserPolicy && user != null) + if (authenticationProvider is IHasNewUserPolicy hasNewUserPolicy && user is not null) { await UpdatePolicyAsync(user.Id, hasNewUserPolicy.GetNewUserPolicy()).ConfigureAwait(false); } } } - if (success && user != null && authenticationProvider != null) + if (success && user is not null && authenticationProvider is not null) { var providerId = authenticationProvider.GetType().FullName; - if (providerId != null && !string.Equals(providerId, user.AuthenticationProviderId, StringComparison.OrdinalIgnoreCase)) + if (providerId is not null && !string.Equals(providerId, user.AuthenticationProviderId, StringComparison.OrdinalIgnoreCase)) { user.AuthenticationProviderId = providerId; await UpdateUserAsync(user).ConfigureAwait(false); } } - if (user == null) + if (user is null) { _logger.LogInformation( "Authentication request for {UserName} has been denied (IP: {IP}).", @@ -501,7 +501,7 @@ namespace Jellyfin.Server.Implementations.Users { var user = string.IsNullOrWhiteSpace(enteredUsername) ? null : GetUserByName(enteredUsername); - if (user != null && isInNetwork) + if (user is not null && isInNetwork) { var passwordResetProvider = GetPasswordResetProvider(user); var result = await passwordResetProvider @@ -708,7 +708,7 @@ namespace Jellyfin.Server.Implementations.Users /// <inheritdoc/> public async Task ClearProfileImageAsync(User user) { - if (user.ProfileImage == null) + if (user.ProfileImage is null) { return; } |
