瀏覽代碼

Remove dashes from pins

LogicalPhallacy 6 年之前
父節點
當前提交
13e94a8b1b
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Emby.Server.Implementations/Library/DefaultPasswordResetProvider.cs

+ 4 - 4
Emby.Server.Implementations/Library/DefaultPasswordResetProvider.cs

@@ -47,13 +47,13 @@ namespace Emby.Server.Implementations.Library
                 using (var str = File.OpenRead(resetfile))
                 {
                     spr = await _jsonSerializer.DeserializeFromStreamAsync<SerializablePasswordReset>(str).ConfigureAwait(false);
-                }
+                }
 
                 if (spr.ExpirationDate < DateTime.Now)
                 {
                     File.Delete(resetfile);
                 }
-                else if (spr.Pin.Equals(pin, StringComparison.InvariantCultureIgnoreCase))
+                else if (spr.Pin.Replace('-', '').Equals(pin.Replace('-', ''), StringComparison.InvariantCultureIgnoreCase))
                 {
                     var resetUser = _userManager.GetUserByName(spr.UserName);
                     if (resetUser == null)
@@ -85,11 +85,11 @@ namespace Emby.Server.Implementations.Library
         {
             string pin = string.Empty;
             using (var cryptoRandom = System.Security.Cryptography.RandomNumberGenerator.Create())
-            {
+            {
                 byte[] bytes = new byte[4];
                 cryptoRandom.GetBytes(bytes);
                 pin = BitConverter.ToString(bytes);
-            }
+            }
 
             DateTime expireTime = DateTime.Now.AddMinutes(30);
             string filePath = _passwordResetFileBase + user.InternalId + ".json";