Redirect from sign-in page to top page if already authenticated (#3781)

This commit is contained in:
Naoki Takezoe
2025-06-22 21:23:15 +09:00
committed by GitHub
parent b9d2efa582
commit c9095722f8

View File

@@ -93,9 +93,13 @@ trait IndexControllerBase extends ControllerBase {
}
get("/signin") {
val redirect = params.get("redirect")
if (redirect.isDefined && redirect.get.startsWith("/")) {
flash.update(Keys.Flash.Redirect, redirect.get)
if (context.loginAccount.nonEmpty) {
redirect("/")
}
params.get("redirect").foreach { redirect =>
if (redirect.startsWith("/")) {
flash.update(Keys.Flash.Redirect, redirect)
}
}
gitbucket.core.html.signin(flash.get("userName"), flash.get("password"), flash.get("error"))
}