Skip to content
Snippets Groups Projects
Commit 38a7ba9f authored by srosse's avatar srosse
Browse files

no-jira: red screen form must send via POST method

parent b9448767
No related branches found
No related tags found
No related merge requests found
......@@ -54,16 +54,6 @@ public class ErrorFeedbackMailer implements Dispatcher {
private static final OLog log = Tracing.createLoggerFor(ErrorFeedbackMailer.class);
private static final ErrorFeedbackMailer INSTANCE = new ErrorFeedbackMailer();
private ErrorFeedbackMailer() {
// private since singleton
}
protected static ErrorFeedbackMailer getInstance() {
return INSTANCE;
}
/**
* send email to olat support with user submitted error informaition
*
......@@ -71,9 +61,6 @@ public class ErrorFeedbackMailer implements Dispatcher {
*/
public void sendMail(HttpServletRequest request) {
String feedback = request.getParameter("textarea");
// fxdiff: correctly get the error-number
// was : String errorNr = feedback.substring(0, feedback.indexOf("\n") -
// 1);
String errorNr = request.getParameter("fx_errnum");
String username = request.getParameter("username");
try {
......@@ -84,29 +71,26 @@ public class ErrorFeedbackMailer implements Dispatcher {
if (ident == null)
ident = im.findIdentityByName("guest");
Collection<String> logFileEntries = LogFileParser.getErrorToday(errorNr, false);
StringBuilder out = new StringBuilder();
StringBuilder out = new StringBuilder(2048);
out.append(feedback)
.append("\n------------------------------------------\n\n --- from user: ").append(username).append(" ---");
if (logFileEntries != null) {
for (Iterator<String> iter = logFileEntries.iterator(); iter.hasNext();) {
out.append(iter.next());
}
}
String body = feedback + "\n------------------------------------------\n\n --- from user: " + username
+ " ---" + out.toString();
MailBundle bundle = new MailBundle();
bundle.setFromId(ident);
bundle.setTo(WebappHelper.getMailConfig("mailError"));
bundle.setContent("Feedback from Error Nr.: " + errorNr, body);
bundle.setContent("Feedback from Error Nr.: " + errorNr, out.toString());
CoreSpringFactory.getImpl(MailManager.class).sendExternMessage(bundle, null);
} catch (Exception e) {
// error in recipient email address(es)
handleException(request, e);
return;
}
}
private void handleException(HttpServletRequest request, Exception e) {
String feedback = request.getParameter("textarea");
String username = request.getParameter("username");
......@@ -123,5 +107,4 @@ public class ErrorFeedbackMailer implements Dispatcher {
sendMail(request);
DispatcherModule.redirectToDefaultDispatcher(response);
}
}
......@@ -133,18 +133,12 @@ $r.renderHeaderIncludes()
## BEGIN ERROR AREA
<div id="o_main" class="o_exception">
<div class="jumbotron">
<h1>$r.translate("error.header")</h1>
<img src="$r.staticLink("images/transparent.gif")" class="o_visual img-rounded pull-right" alt="$r.translateInAttribute("error.header")" />
<p>
$r.translate('error.message1') <a href="mailto:${supportaddress}" class="o_link_mailto">${supportaddress}</a> $r.translate('error.message2')
</p>
<p>
$r.translate('error.report.tell')
</p>
<p>$r.translate('error.message1') <a href="mailto:${supportaddress}" class="o_link_mailto">${supportaddress}</a> $r.translate('error.message2')</p>
<p>$r.translate('error.report.tell')</p>
<form method="get" name="reportform" action="$r.relLink('')error/" id="ofo_366191">
<form id="ofo_366191" name="reportform" method="post" action="$r.relLink('')error/">
<div class="o_button_group">
#if ($allowBackButton)
<a class="btn btn-default" href="javascript:history.back()">
......@@ -193,9 +187,7 @@ $r.translate('error.time') ${time}
## END ERROR AREA
<a id="o_toplink" href="#o_top" onclick="o_scrollToElement('#o_top');" title="$r.translateInAttribute("top.alt")">
<i class="o_icon o_icon_top"></i>
$r.translate("top")
</a>
<i class="o_icon o_icon_top"></i> $r.translate("top")</a>
</div>
## END #o_main -----
......@@ -205,5 +197,4 @@ $r.translate('error.time') ${time}
</div>
</div>
## ---- END footer ---
</body>
</body>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment