1 7 package com.openedit.modules.admin; 8 9 import java.io.Serializable ; 10 11 import com.openedit.OpenEditException; 12 import com.openedit.WebPageRequest; 13 import com.openedit.modules.email.SendMailModule; 14 import com.openedit.modules.email.TemplateWebEmail; 15 import com.openedit.page.manage.PageManager; 16 import com.openedit.modules.email.PostMail; 17 18 24 public class PasswordHelper implements Serializable { 25 26 protected String fieldTo; 27 protected String fieldPassword; 28 29 protected SendMailModule sendMailModule; 30 31 public SendMailModule getSendMailModule() { 32 return sendMailModule; 33 } 34 35 public void setSendMailModule(SendMailModule sendMailModule) { 36 this.sendMailModule = sendMailModule; 37 } 38 39 45 public void emailPasswordReminder(WebPageRequest inContext, PageManager inManager, String inUsername, String inPassword, String inEmail) 46 { 47 48 inContext.setRequestParameter("to", inEmail); 50 51 TemplateWebEmail email = sendMailModule.getPostMail().getTemplateWebEmail(); 52 try { 53 email.loadSettings(inContext, inManager); 54 } catch (OpenEditException e1) { 55 e1.printStackTrace(); 57 } 58 inContext.putPageValue(SendMailModule.EMAIL_SETTINGS,email); 59 if (inUsername != null){ 60 inContext.putPageValue("uname", inUsername); 61 } 62 63 if (inPassword != null){ 64 inContext.putPageValue("pass", inPassword); 65 } 66 67 if (inEmail != null){ 68 inContext.putPageValue("mail", inEmail); 69 } 70 inContext.putPageValue("commandSucceeded", "didnotexecute"); 71 if (inEmail != null && inPassword != null && inUsername != null){ 72 try 73 { 74 sendMailModule.sendEmail( inContext ); 75 inContext.putPageValue("commandSucceeded", "true"); 76 } 77 catch (OpenEditException e) 78 { 79 inContext.putPageValue("commandSucceeded", "false"); 80 inContext.putPageValue("error", e.getLocalizedMessage()); 81 } 82 } 83 } 84 85 } 86 87 | Popular Tags |