pull/733/head
Jamie.Rees 8 years ago
parent eadcba91c4
commit 7a41aef838

@ -62,12 +62,14 @@ namespace PlexRequests.UI.Modules
{ {
return Context.GetRedirect(string.IsNullOrEmpty(baseUrl) ? "~/wizard" : $"~/{baseUrl}/wizard"); return Context.GetRedirect(string.IsNullOrEmpty(baseUrl) ? "~/wizard" : $"~/{baseUrl}/wizard");
} }
if (!Request.IsAjaxRequest())
var redirectPath = string.IsNullOrEmpty(baseUrl) ? "~/userlogin" : $"~/{baseUrl}/userlogin";
if (Session[SessionKeys.UsernameKey] == null && Context?.CurrentUser == null)
{ {
return Context.GetRedirect(redirectPath); var redirectPath = string.IsNullOrEmpty(baseUrl) ? "~/userlogin" : $"~/{baseUrl}/userlogin";
if (Session[SessionKeys.UsernameKey] == null && Context?.CurrentUser == null)
{
return Context.GetRedirect(redirectPath);
}
} }
return null; return null;

@ -59,7 +59,7 @@ namespace PlexRequests.UI.Modules
{ {
if (settings.BeforeLogin) // Before login if (settings.BeforeLogin) // Before login
{ {
if (!string.IsNullOrEmpty(Username)) if (string.IsNullOrEmpty(Username))
{ {
// They are not logged in // They are not logged in
return Context.GetRedirect(Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString()); return Context.GetRedirect(Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString());

@ -41,12 +41,10 @@ using PlexRequests.Core.SettingModels;
using PlexRequests.Core.Users; using PlexRequests.Core.Users;
using PlexRequests.Helpers; using PlexRequests.Helpers;
using PlexRequests.Helpers.Analytics; using PlexRequests.Helpers.Analytics;
using PlexRequests.Helpers.Permissions;
using PlexRequests.Store; using PlexRequests.Store;
using PlexRequests.Store.Models; using PlexRequests.Store.Models;
using PlexRequests.Store.Repository; using PlexRequests.Store.Repository;
using PlexRequests.UI.Authentication; using PlexRequests.UI.Authentication;
using PlexRequests.UI.Helpers;
using ISecurityExtensions = PlexRequests.Core.ISecurityExtensions; using ISecurityExtensions = PlexRequests.Core.ISecurityExtensions;
@ -72,6 +70,34 @@ namespace PlexRequests.UI.Modules
Get["UserLoginIndex", "/", true] = async (x, ct) => Get["UserLoginIndex", "/", true] = async (x, ct) =>
{ {
if (Request.Query["landing"] == null)
{
var s = await LandingPageSettings.GetSettingsAsync();
if (s.Enabled)
{
if (s.BeforeLogin) // Before login
{
if (string.IsNullOrEmpty(Username))
{
// They are not logged in
return
Context.GetRedirect(Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString());
}
return Context.GetRedirect(Linker.BuildRelativeUri(Context, "SearchIndex").ToString());
}
// After login
if (string.IsNullOrEmpty(Username))
{
// Not logged in yet
return Context.GetRedirect(Linker.BuildRelativeUri(Context, "UserLoginIndex").ToString() + "?landing");
}
// Send them to landing
var landingUrl = Linker.BuildRelativeUri(Context, "LandingPageIndex").ToString();
return Context.GetRedirect(landingUrl);
}
}
if (!string.IsNullOrEmpty(Username) || IsAdmin) if (!string.IsNullOrEmpty(Username) || IsAdmin)
{ {
var url = Linker.BuildRelativeUri(Context, "SearchIndex").ToString(); var url = Linker.BuildRelativeUri(Context, "SearchIndex").ToString();

@ -81,7 +81,7 @@
</div> </div>
</div> </div>
@Html.Checkbox(Model.SearchForMovies,"SearchForMovies","Search for Movies"); @Html.Checkbox(Model.SearchForMovies,"SearchForMovies","Search for Movies")
<div class="form-group"> <div class="form-group">

@ -69,17 +69,18 @@
</li> </li>
} }
@*@if (Context.Request.Session[SessionKeys.UsernameKey] != null && !Context.CurrentUser.IsAuthenticated())*@ @*@if (Context.Request.Session[SessionKeys.UsernameKey] != null && !Context.CurrentUser.IsAuthenticated())*@
else if (Html.IsLoggedIn(Context)) // Logged in but not admin else if (Context.CurrentUser != null && Context.CurrentUser.IsAuthenticated()) // Logged in but not admin
{ {
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-user"></i> @UI.Layout_Welcome @Context.CurrentUser.UserName <span class="caret"></span></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-user"></i> @UI.Layout_Welcome @Context.CurrentUser.UserName <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li><a href="@url/changepassword"><i class="fa fa-key"></i> @UI.Layout_ChangePassword</a></li> <li><a href="@url/changepassword"><i class="fa fa-key"></i> @UI.Layout_ChangePassword</a></li>
<li><a href="@url/userlogin/logout"><i class="fa fa-sign-out"></i> @UI.Layout_Logout</a></li> <li><a href="@url/logout"><i class="fa fa-sign-out"></i> @UI.Layout_Logout</a></li>
</ul> </ul>
</li> </li>
} }
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-language" aria-hidden="true"><span class="caret"></span></i></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-language" aria-hidden="true"><span class="caret"></span></i></a>

Loading…
Cancel
Save