diff --git a/sbt.bat b/sbt.bat index d86d1e0..41a5c11 100644 --- a/sbt.bat +++ b/sbt.bat @@ -1,2 +1,2 @@ set SCRIPT_DIR=%~dp0 -java -Dsbt.log.noformat=true -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -jar "%SCRIPT_DIR%\sbt-launch-0.12.3.jar" %* +java -Dsbt.log.noformat=true -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar "%SCRIPT_DIR%\sbt-launch-0.12.3.jar" %* diff --git a/sbt.sh b/sbt.sh index 23c721f..cd2266f 100755 --- a/sbt.sh +++ b/sbt.sh @@ -1 +1 @@ -java -Dsbt.log.noformat=true -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -jar `dirname $0`/sbt-launch-0.12.3.jar "$@" +java -Dsbt.log.noformat=true -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar `dirname $0`/sbt-launch-0.12.3.jar "$@" diff --git a/src/main/scala/app/ControllerBase.scala b/src/main/scala/app/ControllerBase.scala index 5e60eb4..81e1dca 100644 --- a/src/main/scala/app/ControllerBase.scala +++ b/src/main/scala/app/ControllerBase.scala @@ -38,12 +38,15 @@ val account = httpRequest.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account] if(account == null){ // Redirect to login form + // TODO Should use the configured base url. httpResponse.sendRedirect(context + "/signin?" + StringUtil.urlEncode(path)) } else if(account.isAdmin){ // H2 Console (administrators only) + // TODO Should use the configured base url. chain.doFilter(request, response) } else { // Redirect to dashboard + // TODO Should use the configured base url. httpResponse.sendRedirect(context + "/") } } else if(path.startsWith("/git/")){ @@ -116,15 +119,19 @@ includeContextPath: Boolean = true, includeServletPath: Boolean = true) (implicit request: HttpServletRequest, response: HttpServletResponse) = if (path.startsWith("http")) path - else baseUrl + url(path, params, false, false) + else baseUrl + url(path, params, false, false, false) } /** * Context object for the current request. + * + * @param path the context path */ case class Context(path: String, loginAccount: Option[Account], request: HttpServletRequest){ + lazy val currentPath = request.getRequestURI.substring(path.length) + /** * Get object from cache. * diff --git a/src/main/twirl/main.scala.html b/src/main/twirl/main.scala.html index 7ec9842..0d73555 100644 --- a/src/main/twirl/main.scala.html +++ b/src/main/twirl/main.scala.html @@ -61,7 +61,7 @@ } } else { - Sign in + Sign in } @@ -76,7 +76,6 @@ $('#search').submit(function(){ return $.trim($(this).find('input[name=query]').val()) != ''; }); - $('#signin').attr('href', '@path/signin?redirect=' + encodeURIComponent(location.pathname + location.search + location.hash)); });