diff options
| author | dkanada <dkanada@users.noreply.github.com> | 2020-04-23 14:10:22 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-23 14:10:22 +0900 |
| commit | 97d7ffc45899ba2a3b464e1cb6defcf06e29eebb (patch) | |
| tree | acd87502f2fe4b703efa676621fdbf98678baeb8 /Emby.Server.Implementations/Library/UserManager.cs | |
| parent | 07c4dfd8fe7331b80389ae5002397ae134b14f9e (diff) | |
| parent | 07326c1d9b1a74b6802cd4187104c4272d59e28e (diff) | |
Merge pull request #2861 from mark-monteiro/fix-auth-response-codes
Fix Auth Response Codes
Diffstat (limited to 'Emby.Server.Implementations/Library/UserManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/UserManager.cs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index 1612a4624..d63bc6bda 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -20,6 +20,7 @@ using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Providers; @@ -321,23 +322,19 @@ namespace Emby.Server.Implementations.Library 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( - string.Format( - CultureInfo.InvariantCulture, - "The {0} account is currently disabled. Please consult with your administrator.", - user.Name)); + throw new SecurityException($"The {user.Name} account is currently disabled. Please consult with your administrator."); } 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 SecurityException("Forbidden."); } 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 SecurityException("User is not allowed access at this time."); } // Update LastActivityDate and LastLoginDate, then save |
