diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/UserManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/UserManager.cs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index f9d7479ce..1e0bbc39b 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -121,17 +121,20 @@ namespace MediaBrowser.Server.Implementations.Library /// <summary> /// Authenticates a User and returns a result indicating whether or not it succeeded /// </summary> - /// <param name="user">The user.</param> + /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <returns>Task{System.Boolean}.</returns> /// <exception cref="System.ArgumentNullException">user</exception> - public async Task<bool> AuthenticateUser(User user, string password) + /// <exception cref="System.UnauthorizedAccessException"></exception> + public async Task<bool> AuthenticateUser(string username, string password) { - if (user == null) + if (string.IsNullOrWhiteSpace(username)) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException("username"); } + var user = Users.First(i => string.Equals(username, i.Name, StringComparison.OrdinalIgnoreCase)); + if (user.Configuration.IsDisabled) { throw new UnauthorizedAccessException(string.Format("The {0} account is currently disabled. Please consult with your administrator.", user.Name)); |
