Fix Authentication request log

pull/2746/head
dafo90 5 years ago
parent 2fb9e36493
commit 62b0db59aa

@ -264,6 +264,7 @@ namespace Emby.Server.Implementations.Library
{ {
if (string.IsNullOrWhiteSpace(username)) if (string.IsNullOrWhiteSpace(username))
{ {
_logger.LogInformation("Authentication request without username has been denied (IP: {IP}).", remoteEndPoint);
throw new ArgumentNullException(nameof(username)); throw new ArgumentNullException(nameof(username));
} }
@ -319,6 +320,7 @@ namespace Emby.Server.Implementations.Library
if (user == null) if (user == null)
{ {
_logger.LogInformation("Authentication request for {UserName} has been denied (IP: {IP}).", username, remoteEndPoint);
throw new AuthenticationException("Invalid username or password entered."); throw new AuthenticationException("Invalid username or password entered.");
} }
@ -351,14 +353,14 @@ namespace Emby.Server.Implementations.Library
} }
ResetInvalidLoginAttemptCount(user); ResetInvalidLoginAttemptCount(user);
_logger.LogInformation("Authentication request for {UserName} has succeeded.", user.Name);
} }
else else
{ {
IncrementInvalidLoginAttemptCount(user); IncrementInvalidLoginAttemptCount(user);
_logger.LogInformation("Authentication request for {UserName} has been denied (IP: {IP}).", user.Name, remoteEndPoint);
} }
_logger.LogInformation("Authentication request for {0} {1} (IP: {2}).", user.Name, success ? "has succeeded" : "has been denied", remoteEndPoint);
return success ? user : null; return success ? user : null;
} }

Loading…
Cancel
Save