Browse Source

Fix login

Bond_009 5 years ago
parent
commit
efc4805233

+ 2 - 1
Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs

@@ -37,7 +37,7 @@ namespace Emby.Server.Implementations.Library
                 throw new ArgumentNullException(nameof(resolvedUser));
             }
 
-            // As long as jellyfin supports passwordless users, we need this little block here to accomodate
+            // As long as jellyfin supports passwordless users, we need this little block here to accommodate
             if (!HasPassword(resolvedUser) && string.IsNullOrEmpty(password))
             {
                 return Task.FromResult(new ProviderAuthenticationResult
@@ -105,6 +105,7 @@ namespace Emby.Server.Implementations.Library
         public Task ChangePassword(User user, string newPassword)
         {
             ConvertPasswordFormat(user);
+
             // This is needed to support changing a no password user to a password user
             if (string.IsNullOrEmpty(user.Password))
             {

+ 1 - 1
MediaBrowser.Api/UserService.cs

@@ -418,7 +418,7 @@ namespace MediaBrowser.Api
 
                 return ToOptimizedResult(result);
             }
-            catch(SecurityException e)
+            catch (SecurityException e)
             {
                 // rethrow adding IP address to message
                 throw new SecurityException($"[{Request.RemoteIp}] {e.Message}");

+ 8 - 8
MediaBrowser.Model/Cryptography/PasswordHash.cs

@@ -69,6 +69,13 @@ namespace MediaBrowser.Model.Cryptography
             }
         }
 
+        public PasswordHash(ICryptoProvider cryptoProvider)
+        {
+            _id = cryptoProvider.DefaultHashMethod;
+            _salt = cryptoProvider.GenerateSalt();
+            _hash = Array.Empty<Byte>();
+        }
+
         public string Id { get => _id; set => _id = value; }
 
         public Dictionary<string, string> Parameters { get => _parameters; set => _parameters = value; }
@@ -77,13 +84,6 @@ namespace MediaBrowser.Model.Cryptography
 
         public byte[] Hash { get => _hash; set => _hash = value; }
 
-        public PasswordHash(ICryptoProvider cryptoProvider)
-        {
-            _id = cryptoProvider.DefaultHashMethod;
-            _salt = cryptoProvider.GenerateSalt();
-            _hash = Array.Empty<Byte>();
-        }
-
         // TODO: move this class and use the HexHelper class
         public static byte[] ConvertFromByteString(string byteString)
         {
@@ -127,7 +127,7 @@ namespace MediaBrowser.Model.Cryptography
             str.Append(_id);
             SerializeParameters(str);
 
-            if (_salt.Length == 0)
+            if (_salt.Length != 0)
             {
                 str.Append('$');
                 str.Append(ConvertToByteString(_salt));