change authentication flow

pull/2363/head
dkanada 5 years ago
parent 6341d986a9
commit 26dd67a441

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

Loading…
Cancel
Save