This commit is contained in:
tidusjar 2016-07-06 14:24:44 +01:00
parent 5bda83bfdf
commit 8854dc23c7
4 changed files with 279 additions and 277 deletions

View file

@ -55,7 +55,7 @@ namespace PlexRequests.UI.Modules
LandingPageSettings = lp;
Analytics = a;
Api = api;
Get["/", true] = async (x, ct) => await Index();
Get["UserLoginIndex","/", true] = async (x, ct) => await Index();
Post["/"] = x => LoginUser();
Get["/logout"] = x => Logout();
}
@ -69,42 +69,7 @@ namespace PlexRequests.UI.Modules
public async Task<Negotiator> Index()
{
var query = Request.Query["landing"];
var landingCheck = (bool?)query ?? true;
if (landingCheck)
{
var landingSettings = await LandingPageSettings.GetSettingsAsync();
if (landingSettings.Enabled)
{
if (landingSettings.BeforeLogin)
{
#pragma warning disable 4014
Analytics.TrackEventAsync(
#pragma warning restore 4014
Category.LandingPage,
Action.View,
"Going To LandingPage before login",
Username,
CookieHelper.GetAnalyticClientId(Cookies));
var model = new LandingPageViewModel
{
Enabled = landingSettings.Enabled,
Id = landingSettings.Id,
EnabledNoticeTime = landingSettings.EnabledNoticeTime,
NoticeEnable = landingSettings.NoticeEnable,
NoticeEnd = landingSettings.NoticeEnd,
NoticeMessage = landingSettings.NoticeMessage,
NoticeStart = landingSettings.NoticeStart,
ContinueUrl = landingSettings.BeforeLogin ? $"userlogin" : $"search"
};
return View["Landing/Index", model];
}
}
}
var settings = await AuthService.GetSettingsAsync();
return View["Index", settings];
}