Browse Source

Log message for each exception during login

dafo90 5 years ago
parent
commit
dd128b5e30
1 changed files with 3 additions and 0 deletions
  1. 3 0
      Emby.Server.Implementations/Library/UserManager.cs

+ 3 - 0
Emby.Server.Implementations/Library/UserManager.cs

@@ -326,6 +326,7 @@ namespace Emby.Server.Implementations.Library
 
 
             if (user.Policy.IsDisabled)
             if (user.Policy.IsDisabled)
             {
             {
+                _logger.LogInformation("Authentication request for {UserName} has been denied because this account is currently disabled (IP: {IP}).", username, remoteEndPoint);
                 throw new AuthenticationException(
                 throw new AuthenticationException(
                     string.Format(
                     string.Format(
                         CultureInfo.InvariantCulture,
                         CultureInfo.InvariantCulture,
@@ -335,11 +336,13 @@ namespace Emby.Server.Implementations.Library
 
 
             if (!user.Policy.EnableRemoteAccess && !_networkManager.IsInLocalNetwork(remoteEndPoint))
             if (!user.Policy.EnableRemoteAccess && !_networkManager.IsInLocalNetwork(remoteEndPoint))
             {
             {
+                _logger.LogInformation("Authentication request for {UserName} forbidden: remote access disabled and user not in local network (IP: {IP}).", username, remoteEndPoint);
                 throw new AuthenticationException("Forbidden.");
                 throw new AuthenticationException("Forbidden.");
             }
             }
 
 
             if (!user.IsParentalScheduleAllowed())
             if (!user.IsParentalScheduleAllowed())
             {
             {
+                _logger.LogInformation("Authentication request for {UserName} is not allowed at this time due parental restrictions (IP: {IP}).", username, remoteEndPoint);
                 throw new AuthenticationException("User is not allowed access at this time.");
                 throw new AuthenticationException("User is not allowed access at this time.");
             }
             }