mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-04 10:58:38 +00:00
Make login form redirect to landing page if already logged in
This commit is contained in:
parent
9c5c5b5798
commit
94765c67f3
2 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue