Merge branch 'master' into add-features-to-ldapauth

This commit is contained in:
yjkony
2014-03-04 10:16:24 +09:00
4 changed files with 11 additions and 5 deletions

View File

@@ -1,2 +1,2 @@
set SCRIPT_DIR=%~dp0 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" %*

2
sbt.sh
View File

@@ -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 "$@"

View File

@@ -38,12 +38,15 @@ abstract class ControllerBase extends ScalatraFilter
val account = httpRequest.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account] val account = httpRequest.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account]
if(account == null){ if(account == null){
// Redirect to login form // Redirect to login form
// TODO Should use the configured base url.
httpResponse.sendRedirect(context + "/signin?" + StringUtil.urlEncode(path)) httpResponse.sendRedirect(context + "/signin?" + StringUtil.urlEncode(path))
} else if(account.isAdmin){ } else if(account.isAdmin){
// H2 Console (administrators only) // H2 Console (administrators only)
// TODO Should use the configured base url.
chain.doFilter(request, response) chain.doFilter(request, response)
} else { } else {
// Redirect to dashboard // Redirect to dashboard
// TODO Should use the configured base url.
httpResponse.sendRedirect(context + "/") httpResponse.sendRedirect(context + "/")
} }
} else if(path.startsWith("/git/")){ } else if(path.startsWith("/git/")){
@@ -116,15 +119,19 @@ abstract class ControllerBase extends ScalatraFilter
includeContextPath: Boolean = true, includeServletPath: Boolean = true) includeContextPath: Boolean = true, includeServletPath: Boolean = true)
(implicit request: HttpServletRequest, response: HttpServletResponse) = (implicit request: HttpServletRequest, response: HttpServletResponse) =
if (path.startsWith("http")) path 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. * Context object for the current request.
*
* @param path the context path
*/ */
case class Context(path: String, loginAccount: Option[Account], request: HttpServletRequest){ case class Context(path: String, loginAccount: Option[Account], request: HttpServletRequest){
lazy val currentPath = request.getRequestURI.substring(path.length)
/** /**
* Get object from cache. * Get object from cache.
* *

View File

@@ -61,7 +61,7 @@
} }
<a href="@path/signout" class="menu-last" data-toggle="tooltip" data-placement="bottom" title="Sign out"><i class="icon-share-alt"></i></a> <a href="@path/signout" class="menu-last" data-toggle="tooltip" data-placement="bottom" title="Sign out"><i class="icon-share-alt"></i></a>
} else { } else {
<a href="@path/signin" class="btn btn-last" id="signin">Sign in</a> <a href="@path/signin?redirect=@urlEncode(currentPath)" class="btn btn-last" id="signin">Sign in</a>
} }
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div> </div>
@@ -76,7 +76,6 @@
$('#search').submit(function(){ $('#search').submit(function(){
return $.trim($(this).find('input[name=query]').val()) != ''; return $.trim($(this).find('input[name=query]').val()) != '';
}); });
$('#signin').attr('href', '@path/signin?redirect=' + encodeURIComponent(location.pathname + location.search + location.hash));
}); });
</script> </script>
</body> </body>