浏览代码

Merge pull request #2146 from cromefire/patch-1

Fix invalid username handling
Bond-009 5 年之前
父节点
当前提交
b8c61a5c40
共有 1 个文件被更改,包括 6 次插入7 次删除
  1. 6 7
      Emby.Server.Implementations/Session/SessionManager.cs

+ 6 - 7
Emby.Server.Implementations/Session/SessionManager.cs

@@ -1389,6 +1389,12 @@ namespace Emby.Server.Implementations.Session
                 }
             }
 
+            if (user == null)
+            {
+                AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request));
+                throw new SecurityException("Invalid user or password entered.");
+            }
+
             if (enforcePassword)
             {
                 user = await _userManager.AuthenticateUser(
@@ -1399,13 +1405,6 @@ namespace Emby.Server.Implementations.Session
                     true).ConfigureAwait(false);
             }
 
-            if (user == null)
-            {
-                AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request));
-
-                throw new SecurityException("Invalid user or password entered.");
-            }
-
             var token = GetAuthorizationToken(user, request.DeviceId, request.App, request.AppVersion, request.DeviceName);
 
             var session = LogSessionActivity(