private void setupEmailVerification() {
if (Utils.getEmailVerificationSubscriber() == null) {
return;
}
EmailVerifierConfig emailVerifierConfig = Utils.getEmailVerifierConfig();
if (emailVerifierConfig == null) {
String fileName = CarbonUtils.getCarbonConfigDirPath() + File.separator +
"notifications-email-verification.xml";
if ((new File(fileName)).exists()) {
emailVerifierConfig = Util.loadeMailVerificationConfig(fileName);
}
if (emailVerifierConfig == null) {
emailVerifierConfig = new EmailVerifierConfig();
}
if (emailVerifierConfig.getEmailBody() == null) {
emailVerifierConfig.setEmailBody("To complete your subscription process, please " +
"click on the link below to verify your e-mail address.");
}
if (emailVerifierConfig.getEmailFooter() == null) {
emailVerifierConfig.setEmailFooter("This message is automatically generated " +
"by the WSO2 Carbon Registry.");
}
if (emailVerifierConfig.getTargetEpr() == null) {
String registryURL = Utils.getDefaultEventingServiceURL();
if (registryURL != null && registryURL.indexOf(
"/services/RegistryEventingService") > -1) {
registryURL = registryURL.substring(0, registryURL.length() -
"/services/RegistryEventingService".length()) +
"/carbon";
}
if (registryURL == null) {
log.error("Unable to obtain registry URL");
emailVerifierConfig = null;
return;
}
if (!registryURL.endsWith("/")) {
registryURL = registryURL + "/";
}
emailVerifierConfig.setTargetEpr(registryURL +
"info/subscription-email-verification.jsp");
}
if (emailVerifierConfig.getSubject() == null) {
emailVerifierConfig.setSubject("E-mail Address Verification");
}
if (emailVerifierConfig.getRedirectPath() == null) {
emailVerifierConfig.setRedirectPath("../info/subscription-email-verified.jsp");
}
log.debug("The E-mail Verfication Component Configuration has been done.");
Utils.setEmailVerifierConfig(emailVerifierConfig);
}
}