Browse Source

LoginCounter: Use UTC instead of local time

Tal Aloni 7 years ago
parent
commit
9cb4d12546
1 changed files with 3 additions and 3 deletions
  1. 3 3
      SMBLibrary/Authentication/LoginCounter.cs

+ 3 - 3
SMBLibrary/Authentication/LoginCounter.cs

@@ -40,7 +40,7 @@ namespace SMBLibrary.Authentication
                 LoginEntry entry;
                 if (m_loginEntries.TryGetValue(userID, out entry))
                 {
-                    if (entry.LoginWindowStartDT.Add(m_loginWindowDuration) >= DateTime.Now)
+                    if (entry.LoginWindowStartDT.Add(m_loginWindowDuration) >= DateTime.UtcNow)
                     {
                         // Existing login Window
                         if (incrementCount)
@@ -55,7 +55,7 @@ namespace SMBLibrary.Authentication
                         {
                             return true;
                         }
-                        entry.LoginWindowStartDT = DateTime.Now;
+                        entry.LoginWindowStartDT = DateTime.UtcNow;
                         entry.NumberOfAttempts = 1;
                     }
                 }
@@ -66,7 +66,7 @@ namespace SMBLibrary.Authentication
                         return true;
                     }
                     entry = new LoginEntry();
-                    entry.LoginWindowStartDT = DateTime.Now;
+                    entry.LoginWindowStartDT = DateTime.UtcNow;
                     entry.NumberOfAttempts = 1;
                     m_loginEntries.Add(userID, entry);
                 }