change authentication flow

This commit is contained in:
dkanada 2020-02-02 00:09:18 +09:00
parent 6341d986a9
commit 26dd67a441

View File

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