Fixed 401 response to all css and js queries. Added reason to "cancel"

This commit is contained in:
Rsl1122 2018-02-07 14:36:12 +02:00
parent ef6ffdb980
commit 66e3f61203
3 changed files with 17 additions and 7 deletions

View File

@ -407,4 +407,13 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
Collections.sort(servers);
return servers;
}
@Override
public List<UUID> getServerUUIDs() throws DBException {
try {
return serverTable.getServerUUIDs();
} catch (SQLException e) {
throw SQLErrorUtil.getExceptionFor(e);
}
}
}

View File

@ -87,6 +87,13 @@ public class ResponseHandler extends TreePageHandler {
private Response getResponse(Request request, String targetString, List<String> target) throws WebException {
Optional<Authentication> authentication = Optional.empty();
if (targetString.endsWith(".css")) {
return ResponseCache.loadResponse(PageId.CSS.of(targetString), () -> new CSSResponse(targetString));
}
if (targetString.endsWith(".js")) {
return ResponseCache.loadResponse(PageId.JS.of(targetString), () -> new JavaScriptResponse(targetString));
}
if (webServer.isAuthRequired()) {
authentication = request.getAuth();
if (!authentication.isPresent()) {
@ -97,12 +104,6 @@ public class ResponseHandler extends TreePageHandler {
}
}
}
if (targetString.endsWith(".css")) {
return ResponseCache.loadResponse(PageId.CSS.of(targetString), () -> new CSSResponse(targetString));
}
if (targetString.endsWith(".js")) {
return ResponseCache.loadResponse(PageId.JS.of(targetString), () -> new JavaScriptResponse(targetString));
}
PageHandler pageHandler = getPageHandler(target);
if (pageHandler == null) {
return DefaultResponses.NOT_FOUND.get();

View File

@ -49,7 +49,7 @@ public class PromptAuthorizationResponse extends ErrorResponse {
reason += errorBuilder.toString();
}
response.setParagraph("Authentication Failed.<br>Reason: " + reason + TIPS);
response.setParagraph("Authentication Failed.</p><p><b>Reason: " + reason + "</b></p><p>" + TIPS);
response.replacePlaceholders();
return response;
}