use client messages

This commit is contained in:
Sebastian Sdorra
2014-03-16 11:28:09 +01:00
parent 2f9e761644
commit 9db7284f27
6 changed files with 35 additions and 32 deletions

View File

@@ -38,6 +38,7 @@ import com.google.inject.Singleton;
import org.eclipse.jgit.http.server.GitSmartHttpTools;
import sonia.scm.ClientMessages;
import sonia.scm.config.ScmConfiguration;
import sonia.scm.repository.GitUtil;
import sonia.scm.web.filter.AutoLoginModule;
@@ -60,12 +61,6 @@ import javax.servlet.http.HttpServletResponse;
public class GitBasicAuthenticationFilter extends BasicAuthenticationFilter
{
/** Field description */
private static final String MESSAGE_FAILED_AUTHENTICATION =
"Invalid username or password.";
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
*
@@ -96,10 +91,12 @@ public class GitBasicAuthenticationFilter extends BasicAuthenticationFilter
HttpServletResponse response)
throws IOException
{
System.out.println(ClientMessages.get(request).failedAuthentication());
if (GitUtil.isGitClient(request))
{
GitSmartHttpTools.sendError(request, response,
HttpServletResponse.SC_FORBIDDEN, MESSAGE_FAILED_AUTHENTICATION);
HttpServletResponse.SC_FORBIDDEN,
ClientMessages.get(request).failedAuthentication());
}
else
{

View File

@@ -40,6 +40,7 @@ import com.google.inject.Singleton;
import org.eclipse.jgit.http.server.GitSmartHttpTools;
import sonia.scm.ClientMessages;
import sonia.scm.config.ScmConfiguration;
import sonia.scm.repository.GitUtil;
import sonia.scm.repository.RepositoryProvider;
@@ -72,10 +73,6 @@ public class GitPermissionFilter extends ProviderPermissionFilter
/** Field description */
public static final String URI_REF_INFO = "/info/refs";
/** Field description */
private static final String MESSAGE_NOT_ENOUGH_PRIVILEGES =
"You do not have enough access privileges for this operation.";
//~--- constructors ---------------------------------------------------------
/**
@@ -110,7 +107,8 @@ public class GitPermissionFilter extends ProviderPermissionFilter
if (GitUtil.isGitClient(request))
{
GitSmartHttpTools.sendError(request, response,
HttpServletResponse.SC_FORBIDDEN, MESSAGE_NOT_ENOUGH_PRIVILEGES);
HttpServletResponse.SC_FORBIDDEN,
ClientMessages.get(request).notEnoughPrivileges());
}
else
{