1 package dinamica.security; 2 3 import dinamica.*; 4 5 13 public class LoginFailedAlert extends GenericTransaction 14 { 15 16 19 public int service(Recordset inputParams) throws Throwable 20 { 21 22 String enabled = getConfig().getConfigValue("//mail/enabled"); 24 25 if (enabled.equals("true")) 26 { 27 String host = getConfig().getConfigValue("//mail/host"); 28 String subject = getConfig().getConfigValue("//mail/subject"); 29 String from = getConfig().getConfigValue("//mail/from"); 30 String fromName = getConfig().getConfigValue("//mail/from-name");; 31 String to = getConfig().getConfigValue("//mail/to"); 32 String body = getResource("body.txt"); 33 34 TemplateEngine t = new TemplateEngine(getContext(),getRequest(), body); 36 t.replaceDefaultValues(); 37 t.replaceLabels(); 38 t.replaceRequestAttributes(); 39 body = t.toString(); 40 41 SimpleMail s = new SimpleMail(); 43 s.send(host,from,fromName,to,subject,body); 44 45 } 46 47 String res = getResource("log-template.txt"); 49 TemplateEngine t = new TemplateEngine(getContext(),getRequest(), res); 50 t.replaceDefaultValues(); 51 t.replaceLabels(); 52 t.replaceRequestAttributes(); 53 res = t.toString(); 54 System.err.println(res); 55 56 return 0; 57 58 } 59 60 } 61 | Popular Tags |