From ce95fe468fc9080f8329e5d0314cff1e97c6e407 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 16 Dec 2016 21:21:58 +0000 Subject: [PATCH] #788 fixed! --- PlexRequests.UI/Modules/UserLoginModule.cs | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/PlexRequests.UI/Modules/UserLoginModule.cs b/PlexRequests.UI/Modules/UserLoginModule.cs index 1276df045..35db4c40a 100644 --- a/PlexRequests.UI/Modules/UserLoginModule.cs +++ b/PlexRequests.UI/Modules/UserLoginModule.cs @@ -232,12 +232,25 @@ private async Task LoginUser() { if (!settings.UserAuthentication)// Do not need to auth make admin use login screen for now TODO remove this { - var perms = (Permissions)dbUser.Permissions; - if (perms.HasFlag(Permissions.Administrator)) + if (dbUser != null) { - var uri = Linker.BuildRelativeUri(Context, "UserLoginIndex"); - Session["TempMessage"] = Resources.UI.UserLogin_AdminUsePassword; - return Response.AsRedirect(uri.ToString()); + var perms = (Permissions) dbUser.Permissions; + if (perms.HasFlag(Permissions.Administrator)) + { + var uri = Linker.BuildRelativeUri(Context, "UserLoginIndex"); + Session["TempMessage"] = Resources.UI.UserLogin_AdminUsePassword; + return Response.AsRedirect(uri.ToString()); + } + } + if (plexLocal != null) + { + var perms = (Permissions)plexLocal.Permissions; + if (perms.HasFlag(Permissions.Administrator)) + { + var uri = Linker.BuildRelativeUri(Context, "UserLoginIndex"); + Session["TempMessage"] = Resources.UI.UserLogin_AdminUsePassword; + return Response.AsRedirect(uri.ToString()); + } } } }