KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > modules > admin > PasswordHelper


1 /*
2  * Created on Jun 14, 2004
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Generation - Code and Comments
6  */

7 package com.openedit.modules.admin;
8
9 import java.io.Serializable JavaDoc;
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 /**
19  * @author mcgaha_b
20  *
21  * TODO To change the template for this generated type comment go to
22  * Window - Preferences - Java - Code Generation - Code and Comments
23  */

24 public class PasswordHelper implements Serializable JavaDoc {
25     
26     protected String JavaDoc fieldTo;
27     protected String JavaDoc 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     /**
40      * @param inContext
41      * @param username
42      * @param password
43      * @param email
44      */

45     public void emailPasswordReminder(WebPageRequest inContext, PageManager inManager, String JavaDoc inUsername, String JavaDoc inPassword, String JavaDoc inEmail)
46     {
47     
48         //TO
49
inContext.setRequestParameter("to", inEmail);
50         
51         TemplateWebEmail email = sendMailModule.getPostMail().getTemplateWebEmail();
52         try {
53             email.loadSettings(inContext, inManager);
54         } catch (OpenEditException e1) {
55             // TODO Auto-generated catch block
56
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