Explorar o código

change authentication flow

dkanada %!s(int64=5) %!d(string=hai) anos
pai
achega
26dd67a441
Modificáronse 1 ficheiros con 6 adicións e 10 borrados
  1. 6 10
      Emby.Server.Implementations/Session/SessionManager.cs

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

@@ -1379,20 +1379,16 @@ namespace Emby.Server.Implementations.Session
                 user = _userManager.GetUserByName(request.Username);
             }
 
-            if (user != null)
+            if (user == null)
             {
-                // TODO: Move this to userManager?
-                if (!string.IsNullOrEmpty(request.DeviceId)
-                    && !_deviceManager.CanAccessDevice(user, request.DeviceId))
-                {
-                    throw new SecurityException("User is not allowed access from this device.");
-                }
+                AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request));
+                throw new SecurityException("Invalid username or password entered.");
             }
 
-            if (user == null)
+            if (!string.IsNullOrEmpty(request.DeviceId)
+                && !_deviceManager.CanAccessDevice(user, request.DeviceId))
             {
-                AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request));
-                throw new SecurityException("Invalid user or password entered.");
+                throw new SecurityException("User is not allowed access from this device.");
             }
 
             if (enforcePassword)