Fixed invalid username handling

This commit is contained in:
Cromefire_ 2019-12-13 15:27:12 +01:00 committed by GitHub
parent 96a5dda9ff
commit 6231fc18ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1393,6 +1393,13 @@ 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) if (enforcePassword)
{ {
user = await _userManager.AuthenticateUser( user = await _userManager.AuthenticateUser(
@ -1403,13 +1410,6 @@ namespace Emby.Server.Implementations.Session
true).ConfigureAwait(false); 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 token = GetAuthorizationToken(user, request.DeviceId, request.App, request.AppVersion, request.DeviceName);
var session = LogSessionActivity( var session = LogSessionActivity(