邮箱验证代码

判断重发邮件行为


else if("againemail".equals(request.getParameter("task"))){
     //页面操作错误信息
     String err = "";
     //初始化
     com.zjseek.dao._RootDAO.initialize();
     com.zjseek.dao.MemberDAO mdao = new com.zjseek.dao.MemberDAO();
     String useremail3 = ParamUtils.getParameter(request,"em3","");
//      System.out.println(useremail3);
     String userpassword = ParamUtils.getParameter(request,"userpassword","");
         mem = new com.zjseek.Member();
     Member ma = mdao.getByEmail(useremail3);
     if(!"".equals(userpassword))
mem.setUserpassword(com.zjseek.util.SecurityUtils.getDigest(userpassword));
ma.setUseremail(useremail3);
if(useremail3.endsWith("@abc.com"))
{
ma.setUserstatus(-1);
}
try{
String subject = "全球酒店用品网(519d.com)";
ma.setSendmailtime(new java.util.Date());
ma.setUserstatus(0);
mdao.update(ma);

com.zjseek.util.Template body = new com.zjseek.util.Template();
body.loadTemplate(pageContext.getServletContext().getRealPath("/membership/getregister.htm"),"main");
body.setVar("textfield",ma.getUsername());
body.setVar("path","http://localhost:8081/membership/To_registerok.jsp?u="+ma.getUsername()+"&e="+ma.getUserpassword());
body.parse("main",false);
com.zjseek.util.MailUtils sendmail = new com.zjseek.util.MailUtils();
try{
sendmail.setTo(useremail3);
sendmail.setSubject(subject);
sendmail.setMsgHtml1(body.printVar("main"));
sendmail.sendMsg();
com.zjseek.util.Common.alert(out,"系统已重新发送激活邮件到您的邮箱" + ma.getUseremail() + ",请重新登录邮箱验证用户。");
out.println("<script language=javascript>window.location.href='http://localhost:8081/membership/login.jsp'</script>");

}
catch(Exception e){
e.printStackTrace();
}
Template tpel  = loadTemplate(pageContext,"main",3,true);
tpel.setVar("textfield",ma.getUsername());
tpel.setVar("useremail3",ma.getUseremail());
out.println(parse(tpel,"main"));
return;
}catch(Exception e){
e.printStackTrace();
java.io.StringWriter sw = new java.io.StringWriter();
e.printStackTrace(new java.io.PrintWriter(sw));
err += "未知错误:" + sw.toString();
  }

  tpl.setVar("err",err);
}

你可能感兴趣的:(DAO,jsp)