The Free Software Media System - Server Backend & API
Merge branch 'master' into check-stored-password-exists
aled05f736defb9b
diff --cc Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.csindex 7c7bfa1111,162dc6f5e3..94b582cdef--- a/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs+++ b/Jellyfin.Server.Implementations/Users/DefaultAuthenticationProvider.cs@@@ -61,29 -63,25 +63,29 @@@ namespace Jellyfin.Server.Implementatio});}- byte[] passwordBytes = Encoding.UTF8.GetBytes(password);-- PasswordHash readyHash = PasswordHash.Parse(resolvedUser.Password);- if (_cryptographyProvider.GetSupportedHashMethods().Contains(readyHash.Id)- || _cryptographyProvider.DefaultHashMethod == readyHash.Id)+ // Handle the case when the stored password is null, but the user tried to login with a password+ if (resolvedUser.Password != null){- byte[] passwordbytes = Encoding.UTF8.GetBytes(password);- byte[] calculatedHash = _cryptographyProvider.ComputeHash(- readyHash.Id,- passwordBytes,- readyHash.Salt.ToArray());++ byte[] passwordBytes = Encoding.UTF8.GetBytes(password);- if (readyHash.Hash.SequenceEqual(calculatedHash))+ PasswordHash readyHash = PasswordHash.Parse(resolvedUser.Password);+ if (_cryptographyProvider.GetSupportedHashMethods().Contains(readyHash.Id)+ || _cryptographyProvider.DefaultHashMethod == readyHash.Id){- success = true;+ byte[] calculatedHash = _cryptographyProvider.ComputeHash(+ readyHash.Id,- passwordbytes,++ passwordBytes,+ readyHash.Salt.ToArray());++ if (readyHash.Hash.SequenceEqual(calculatedHash))+ {+ success = true;+ }+ }+ else+ {+ throw new AuthenticationException($"Requested crypto method not available in provider: {readyHash.Id}");}- }- else- {- throw new AuthenticationException($"Requested crypto method not available in provider: {readyHash.Id}");}if (!success)