Redirect to search if we are already logged in #488

pull/511/head
tidusjar 8 years ago
parent 265d1bdd25
commit 0fe7bba9ac

@ -61,7 +61,17 @@ namespace PlexRequests.UI.Modules
PlexSettings = plexSettings;
Linker = linker;
Get["UserLoginIndex", "/", true] = async (x, ct) => await Index();
Get["UserLoginIndex", "/", true] = async (x, ct) =>
{
if (!string.IsNullOrEmpty(Username) || IsAdmin)
{
var uri = Linker.BuildAbsoluteUri(Context, "SearchIndex");
return Response.AsRedirect(uri.ToString());
}
var settings = await AuthService.GetSettingsAsync();
return View["Index", settings];
};
Post["/", true] = async (x, ct) => await LoginUser();
Get["/logout"] = x => Logout();
}
@ -75,12 +85,6 @@ namespace PlexRequests.UI.Modules
private static Logger Log = LogManager.GetCurrentClassLogger();
public async Task<Negotiator> Index()
{
var settings = await AuthService.GetSettingsAsync();
return View["Index", settings];
}
private async Task<Response> LoginUser()
{
var dateTimeOffset = Request.Form.DateTimeOffset;

Loading…
Cancel
Save