diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-02-19 21:07:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-19 21:07:09 +0100 |
| commit | 0f173e1778577f11d86da38ff2174ac1f0e7d612 (patch) | |
| tree | 20812a41d73520d58efe2a69f9b2b52b022c980d /Emby.Server.Implementations/Session/SessionManager.cs | |
| parent | cefac4f886e82a642380586b3d732e729cd76dd1 (diff) | |
| parent | cef796a5ba6dd256f425fb87c13d63c724499058 (diff) | |
Merge branch 'master' into sessionmanager
Diffstat (limited to 'Emby.Server.Implementations/Session/SessionManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionManager.cs | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index a6a5523de..dfcd3843c 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1401,20 +1401,16 @@ namespace Emby.Server.Implementations.Session user = _userManager.GetUserByName(request.Username); } - if (user != null) + if (user == null) { - // TODO: Move this to userManager? - if (!string.IsNullOrEmpty(request.DeviceId) - && !_deviceManager.CanAccessDevice(user, request.DeviceId)) - { - throw new SecurityException("User is not allowed access from this device."); - } + AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request)); + throw new SecurityException("Invalid username or password entered."); } - if (user == null) + if (!string.IsNullOrEmpty(request.DeviceId) + && !_deviceManager.CanAccessDevice(user, request.DeviceId)) { - AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request)); - throw new SecurityException("Invalid user or password entered."); + throw new SecurityException("User is not allowed access from this device."); } if (enforcePassword) @@ -1727,16 +1723,16 @@ namespace Emby.Server.Implementations.Session /// <inheritdoc /> public void ReportNowViewingItem(string sessionId, BaseItemDto item) { - throw new NotImplementedException(); + var session = GetSession(sessionId); - // var session = GetSession(sessionId); - // session.NowViewingItem = item; + session.NowViewingItem = item; } /// <inheritdoc /> public void ReportTranscodingInfo(string deviceId, TranscodingInfo info) { - var session = Sessions.FirstOrDefault(i => string.Equals(i.DeviceId, deviceId, StringComparison.Ordinal)); + var session = Sessions.FirstOrDefault(i => + string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase)); if (session != null) { @@ -1752,8 +1748,11 @@ namespace Emby.Server.Implementations.Session /// <inheritdoc /> public SessionInfo GetSession(string deviceId, string client, string version) - => Sessions.FirstOrDefault( - i => string.Equals(i.DeviceId, deviceId, StringComparison.Ordinal) && string.Equals(i.Client, client, StringComparison.Ordinal)); + { + return Sessions.FirstOrDefault(i => + string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase) + && string.Equals(i.Client, client, StringComparison.OrdinalIgnoreCase)); + } /// <inheritdoc /> public SessionInfo GetSessionByAuthenticationToken(AuthenticationInfo info, string deviceId, string remoteEndpoint, string appVersion) |
