diff --git a/PlexRequests.UI/Modules/BaseAuthModule.cs b/PlexRequests.UI/Modules/BaseAuthModule.cs index fbedffd32..3dcf930da 100644 --- a/PlexRequests.UI/Modules/BaseAuthModule.cs +++ b/PlexRequests.UI/Modules/BaseAuthModule.cs @@ -30,6 +30,9 @@ using Nancy.Extensions; using PlexRequests.UI.Models; using System; +using PlexRequests.Core; +using PlexRequests.Core.SettingModels; + namespace PlexRequests.UI.Modules { public class BaseAuthModule : BaseModule @@ -74,11 +77,14 @@ namespace PlexRequests.UI.Modules private Response CheckAuth() { - if (Session[SessionKeys.UsernameKey] == null) - { - return Context.GetRedirect("~/test/userlogin"); - } - return null; + var settings = Locator.Resolve>().GetSettings(); + var baseUrl = settings.BaseUrl; + + var redirectPath = string.IsNullOrEmpty(baseUrl) ? "~/userlogin" : $"~/{baseUrl}/userlogin"; + + return Session[SessionKeys.UsernameKey] == null + ? Context.GetRedirect(redirectPath) + : null; } } diff --git a/PlexRequests.UI/Modules/BaseModule.cs b/PlexRequests.UI/Modules/BaseModule.cs index e3f4a47ca..7048d09dd 100644 --- a/PlexRequests.UI/Modules/BaseModule.cs +++ b/PlexRequests.UI/Modules/BaseModule.cs @@ -34,7 +34,7 @@ namespace PlexRequests.UI.Modules { public class BaseModule : NancyModule { - private ServiceLocator Locator => ServiceLocator.Instance; + protected ServiceLocator Locator => ServiceLocator.Instance; public BaseModule() { var settings = Locator.Resolve>().GetSettings();