diff --git a/src/main/scala/gitbucket/core/controller/IndexController.scala b/src/main/scala/gitbucket/core/controller/IndexController.scala
index 524f26f..ddcaa6c 100644
--- a/src/main/scala/gitbucket/core/controller/IndexController.scala
+++ b/src/main/scala/gitbucket/core/controller/IndexController.scala
@@ -19,11 +19,12 @@
self: RepositoryService with ActivityService with AccountService with RepositorySearchService
with UsersAuthenticator with ReferrerAuthenticator =>
- case class SignInForm(userName: String, password: String)
+ case class SignInForm(userName: String, password: String, hash: Option[String])
val signinForm = mapping(
"userName" -> trim(label("Username", text(required))),
- "password" -> trim(label("Password", text(required)))
+ "password" -> trim(label("Password", text(required))),
+ "hash" -> trim(optional(text()))
)(SignInForm.apply)
// val searchForm = mapping(
@@ -54,7 +55,7 @@
post("/signin", signinForm){ form =>
authenticate(context.settings, form.userName, form.password) match {
- case Some(account) => signin(account)
+ case Some(account) => signin(account, form.hash)
case None => {
flash += "userName" -> form.userName
flash += "password" -> form.password
@@ -86,7 +87,7 @@
/**
* Set account information into HttpSession and redirect.
*/
- private def signin(account: Account) = {
+ private def signin(account: Account, hash: Option[String]) = {
session.setAttribute(Keys.Session.LoginAccount, account)
updateLastLoginDate(account.userName)
@@ -98,7 +99,7 @@
if(redirectUrl.stripSuffix("/") == request.getContextPath){
redirect("/")
} else {
- redirect(redirectUrl)
+ redirect(redirectUrl + hash.getOrElse(""))
}
}.getOrElse {
redirect("/")
diff --git a/src/main/twirl/gitbucket/core/signinform.scala.html b/src/main/twirl/gitbucket/core/signinform.scala.html
index e9fb3be..09c27d2 100644
--- a/src/main/twirl/gitbucket/core/signinform.scala.html
+++ b/src/main/twirl/gitbucket/core/signinform.scala.html
@@ -16,7 +16,8 @@
-
+
+
@if(systemSettings.allowAccountRegistration){
or Create new account
}