|
|
|
@ -26,8 +26,7 @@ import javax.mail.internet.InternetAddress;
|
|
|
|
|
*/
|
|
|
|
|
public class MailForm extends MVCPortlet {
|
|
|
|
|
|
|
|
|
|
@ProcessAction(name = "validateCaptcha")
|
|
|
|
|
public void validateCaptcha(ActionRequest actionRequest,
|
|
|
|
|
public void submitSuggestion(ActionRequest actionRequest,
|
|
|
|
|
ActionResponse actionResponse) throws IOException, PortletException {
|
|
|
|
|
|
|
|
|
|
String name = ParamUtil.getString(actionRequest, "name");
|
|
|
|
@ -49,16 +48,6 @@ public class MailForm extends MVCPortlet {
|
|
|
|
|
if (splits.length > 1)
|
|
|
|
|
emailAddress = "info@"+ hostname.split("www.")[1];
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
/**
|
|
|
|
|
* This is the actual code which validate captcha data entered by user.
|
|
|
|
|
*/
|
|
|
|
|
CaptchaUtil.check(actionRequest);
|
|
|
|
|
System.out.println("CAPTCHA validated successfully");
|
|
|
|
|
} catch (CaptchaException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
SessionErrors.add(actionRequest, "errorMessage");
|
|
|
|
|
}
|
|
|
|
|
String bodyTextHTML = "<p>From: " + name + "</p>";
|
|
|
|
|
bodyTextHTML += "<p>Email: " + email + "</p>";
|
|
|
|
|
bodyTextHTML += "<p>Message:</p><p> " + message + "</p>";
|
|
|
|
@ -83,19 +72,5 @@ public class MailForm extends MVCPortlet {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The below code is responsible for rendering the CAPTCHA image
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void serveResource(ResourceRequest resourceRequest,
|
|
|
|
|
ResourceResponse resourceResponse) throws IOException,
|
|
|
|
|
PortletException {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
CaptchaUtil.serveImage(resourceRequest, resourceResponse);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|