diff options
| author | Bond-009 <bond.009@outlook.com> | 2019-01-16 19:10:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-16 19:10:42 +0100 |
| commit | 900dc851e6c810f9e1772a6fb901a5a7e2801baf (patch) | |
| tree | 205bac3cd6df971ee18739e59bd4da0ffe91718b /Emby.Server.Implementations/Library/UserManager.cs | |
| parent | 07a8e49c4b1e4a2dddbaa49ab6f1ff4f271fbf20 (diff) | |
| parent | 933ef438894ed233fec46badf58dd4f26492e832 (diff) | |
Merge branch 'dev' into cleanup
Diffstat (limited to 'Emby.Server.Implementations/Library/UserManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/UserManager.cs | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index 679116fc0..c059cbc75 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common.Events; +using MediaBrowser.Common.Events; using MediaBrowser.Common.Net; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; @@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.Library /// Gets the users. /// </summary> /// <value>The users.</value> - public IEnumerable<User> Users { get { return _users; } } + public IEnumerable<User> Users => _users; private User[] _users; @@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.Library { if (id.Equals(Guid.Empty)) { - throw new ArgumentNullException("id"); + throw new ArgumentNullException(nameof(id)); } return Users.FirstOrDefault(u => u.Id == id); @@ -183,7 +183,7 @@ namespace Emby.Server.Implementations.Library { if (string.IsNullOrWhiteSpace(name)) { - throw new ArgumentNullException("name"); + throw new ArgumentNullException(nameof(name)); } return Users.FirstOrDefault(u => string.Equals(u.Name, name, StringComparison.OrdinalIgnoreCase)); @@ -222,7 +222,7 @@ namespace Emby.Server.Implementations.Library return true; } - private bool IsValidUsernameCharacter(char i) + private static bool IsValidUsernameCharacter(char i) { return !char.Equals(i, '<') && !char.Equals(i, '>'); } @@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.Library { if (string.IsNullOrWhiteSpace(username)) { - throw new ArgumentNullException("username"); + throw new ArgumentNullException(nameof(username)); } var user = Users @@ -344,7 +344,7 @@ namespace Emby.Server.Implementations.Library return success ? user : null; } - private string GetAuthenticationProviderId(IAuthenticationProvider provider) + private static string GetAuthenticationProviderId(IAuthenticationProvider provider) { return provider.GetType().FullName; } @@ -526,7 +526,7 @@ namespace Emby.Server.Implementations.Library { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } var hasConfiguredPassword = GetAuthenticationProvider(user).HasPassword(user).Result; @@ -625,12 +625,12 @@ namespace Emby.Server.Implementations.Library { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } if (string.IsNullOrEmpty(newName)) { - throw new ArgumentNullException("newName"); + throw new ArgumentNullException(nameof(newName)); } if (Users.Any(u => u.Id != user.Id && u.Name.Equals(newName, StringComparison.OrdinalIgnoreCase))) @@ -658,7 +658,7 @@ namespace Emby.Server.Implementations.Library { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } if (user.Id.Equals(Guid.Empty) || !Users.Any(u => u.Id.Equals(user.Id))) @@ -689,7 +689,7 @@ namespace Emby.Server.Implementations.Library { if (string.IsNullOrWhiteSpace(name)) { - throw new ArgumentNullException("name"); + throw new ArgumentNullException(nameof(name)); } if (!IsValidUsername(name)) @@ -737,7 +737,7 @@ namespace Emby.Server.Implementations.Library { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } var allUsers = Users.ToList(); @@ -804,7 +804,7 @@ namespace Emby.Server.Implementations.Library { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } if (user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest) @@ -823,7 +823,7 @@ namespace Emby.Server.Implementations.Library { if (user == null) { - throw new ArgumentNullException("user"); + throw new ArgumentNullException(nameof(user)); } if (newPassword != null) @@ -833,7 +833,7 @@ namespace Emby.Server.Implementations.Library if (string.IsNullOrWhiteSpace(newPasswordHash)) { - throw new ArgumentNullException("newPasswordHash"); + throw new ArgumentNullException(nameof(newPasswordHash)); } user.EasyPassword = newPasswordHash; @@ -848,7 +848,7 @@ namespace Emby.Server.Implementations.Library /// </summary> /// <param name="name">The name.</param> /// <returns>User.</returns> - private User InstantiateNewUser(string name) + private static User InstantiateNewUser(string name) { return new User { @@ -861,10 +861,7 @@ namespace Emby.Server.Implementations.Library }; } - private string PasswordResetFile - { - get { return Path.Combine(ConfigurationManager.ApplicationPaths.ProgramDataPath, "passwordreset.txt"); } - } + private string PasswordResetFile => Path.Combine(ConfigurationManager.ApplicationPaths.ProgramDataPath, "passwordreset.txt"); private string _lastPin; private PasswordPinCreationResult _lastPasswordPinCreationResult; @@ -888,7 +885,7 @@ namespace Emby.Server.Implementations.Library text.AppendLine("Use your web browser to visit:"); text.AppendLine(string.Empty); - text.AppendLine(localAddress + "/web/forgotpasswordpin.html"); + text.AppendLine(localAddress + "/web/index.html#!/forgotpasswordpin.html"); text.AppendLine(string.Empty); text.AppendLine("Enter the following pin code:"); text.AppendLine(string.Empty); @@ -1047,7 +1044,7 @@ namespace Emby.Server.Implementations.Library } } - private UserPolicy GetDefaultPolicy(User user) + private static UserPolicy GetDefaultPolicy(User user) { return new UserPolicy { @@ -1109,12 +1106,12 @@ namespace Emby.Server.Implementations.Library } } - private string GetPolicyFilePath(User user) + private static string GetPolicyFilePath(User user) { return Path.Combine(user.ConfigurationDirectoryPath, "policy.xml"); } - private string GetConfigurationFilePath(User user) + private static string GetConfigurationFilePath(User user) { return Path.Combine(user.ConfigurationDirectoryPath, "config.xml"); } |
