From 6ca771cc7906ae6524f737ae9bf0bc1b916efb40 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 15 Oct 2014 23:26:39 -0400 Subject: move user image into profile settings --- .../Session/SessionManager.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Session') diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 21467ccda..9f77f5294 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -14,6 +14,7 @@ using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Security; using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Connect; using MediaBrowser.Model.Devices; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Events; @@ -1243,7 +1244,14 @@ namespace MediaBrowser.Server.Implementations.Session public async Task AuthenticateNewSession(AuthenticationRequest request, bool isLocal) { - var result = (isLocal && string.Equals(request.App, "Dashboard", StringComparison.OrdinalIgnoreCase)) || + var user = _userManager.Users + .FirstOrDefault(i => string.Equals(request.Username, i.Name, StringComparison.OrdinalIgnoreCase)); + + var allowWithoutPassword = isLocal && + string.Equals(request.App, "Dashboard", StringComparison.OrdinalIgnoreCase) + && !(user != null && user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest); + + var result = allowWithoutPassword || await _userManager.AuthenticateUser(request.Username, request.Password, request.RemoteEndPoint).ConfigureAwait(false); if (!result) @@ -1253,9 +1261,6 @@ namespace MediaBrowser.Server.Implementations.Session throw new AuthenticationException("Invalid user or password entered."); } - var user = _userManager.Users - .First(i => string.Equals(request.Username, i.Name, StringComparison.OrdinalIgnoreCase)); - var token = await GetAuthorizationToken(user.Id.ToString("N"), request.DeviceId, request.App, request.DeviceName).ConfigureAwait(false); EventHelper.FireEventIfNotNull(AuthenticationSucceeded, this, new GenericEventArgs(request), _logger); -- cgit v1.2.3