Better icons to error responses

This commit is contained in:
Rsl1122 2017-11-22 10:50:53 +02:00
parent 709ace0e0a
commit 3d84262fef
4 changed files with 5 additions and 3 deletions

View File

@ -35,6 +35,8 @@ public class ErrorResponse extends Response {
public void replacePlaceholders() {
Map<String, String> placeHolders = new HashMap<>();
placeHolders.put("title", title);
String[] split = title.split(">", 3);
placeHolders.put("titleText", split.length == 3 ? split[2] : title);
placeHolders.put("paragraph", paragraph);
placeHolders.put("version", MiscUtils.getPlanVersion());

View File

@ -10,7 +10,7 @@ public class NotFoundResponse extends ErrorResponse {
public NotFoundResponse() {
super.setHeader("HTTP/1.1 404 Not Found");
super.setTitle(Html.FONT_AWESOME_ICON.parse("exclamation-circle")+" 404 Not Found");
super.setTitle(Html.FONT_AWESOME_ICON.parse("map-signs")+" 404 Not Found");
super.setParagraph("Page does not exist.");
super.replacePlaceholders();
}

View File

@ -11,7 +11,7 @@ public class PromptAuthorizationResponse extends ErrorResponse {
public PromptAuthorizationResponse() {
super.setHeader("HTTP/1.1 401 Access Denied\r\n"
+ "WWW-Authenticate: Basic realm=\"/\";");
super.setTitle(Html.FONT_AWESOME_ICON.parse("times-circle")+" 401 Unauthorized");
super.setTitle(Html.FONT_AWESOME_ICON.parse("lock")+" 401 Unauthorized");
super.setParagraph("Authentication Failed.<br>"
+ "- Ensure you have registered a user with <b>/plan register</b><br>"
+ "- Check that the username and password are correct<br>"

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<title>${title}</title>
<title>${titleText}</title>
<!-- Favicon-->
<link rel="icon" href="favicon.ico" type="image/x-icon">