diff --git a/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml b/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml index 37aeb5c4..fbebba49 100644 --- a/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml @@ -13,7 +13,7 @@ function onSubmit(form) { if (document.referrer !== null && document.referrer !== "") { const url = new URL(document.referrer); - if (url.pathname !== "/logout") + if (url.pathname !== "/logout" && url.pathname !== "/login") document.getElementById("redirect").value = url.pathname; } diff --git a/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml.cs index 9b1b5b99..662f1f5b 100644 --- a/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml.cs +++ b/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml.cs @@ -113,5 +113,11 @@ public class LoginForm : BaseLayout } [UsedImplicitly] - public IActionResult OnGet() => this.Page(); + public IActionResult OnGet() + { + if (this.Database.UserFromWebRequest(this.Request) != null) + return this.RedirectToPage(nameof(LandingPage)); + + return this.Page(); + } } \ No newline at end of file