findpwd2.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:5k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="com.redmoon.forum.person.*"%>
  3. <%@ page import="cn.js.fan.util.*"%>
  4. <%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
  5. <%
  6. String skincode = UserSet.getSkin(request);
  7. if (skincode.equals(""))
  8. skincode = UserSet.defaultSkin;
  9. SkinMgr skm = new SkinMgr();
  10. Skin skin = skm.getSkin(skincode);
  11. if (skin==null)
  12. skin = skm.getSkin(UserSet.defaultSkin);
  13. String skinPath = skin.getPath();
  14. %>
  15. <html>
  16. <head>
  17. <title><%=Global.AppName%> - <lt:Label res="res.label.findpwd" key="findpwd"/>2</title>
  18. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  19. <LINK href="forum/<%=skinPath%>/skin.css" type=text/css rel=stylesheet>
  20. <style type="text/css">
  21. <!--
  22. body {
  23. margin-top: 0px;
  24. margin-left: 0px;
  25. margin-right: 0px;
  26. }
  27. .style1 {
  28. color: #FFFFFF;
  29. font-weight: bold;
  30. }
  31. .STYLE2 {color: #FFFFFF}
  32. -->
  33. </style></head>
  34. <body bgcolor="#FFFFFF" text="#000000">
  35. <%@ include file="forum/inc/header.jsp"%>
  36. <jsp:useBean id="sendmail" scope="page" class="cn.js.fan.mail.SendMail"/>
  37. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  38. <%
  39. String name = ParamUtil.get(request, "name");
  40. if (name.equals("")) {
  41. out.print(StrUtil.Alert_Back(SkinUtil.LoadString(request, "res.label.findpwd", "need_user_name")));
  42. return;
  43. }
  44. UserDb user = new UserDb();
  45. user = user.getUserDbByNick(name);
  46. if (user==null || !user.isLoaded()) {
  47. String str = SkinUtil.LoadString(request, "res.label.findpwd", "user_not_exist");
  48. str = StrUtil.format(str, new Object[] {name} );
  49. out.print(SkinUtil.makeErrMsg(request, str));
  50. return;
  51. }
  52. String answer = ParamUtil.get(request, "answer");
  53. if (!answer.equals("")) {
  54. if (answer.equals(user.getAnswer())) {
  55. String to = user.getEmail();
  56. // to = "dsfadasfasfasfd@bndsfdafsadff.com";
  57. String mailserver = Global.smtpServer;
  58. int smtp_port = Global.smtpPort;
  59. String smtpname = Global.smtpUser;
  60. String pwd_raw = Global.smtpPwd;
  61. sendmail.initSession(mailserver, smtpname, pwd_raw);
  62. String senderName = Global.AppName;
  63. senderName = StrUtil.GBToUnicode(senderName);
  64. senderName = senderName + "<" + Global.email + ">";
  65. String subject = StrUtil.format(SkinUtil.LoadString(request, "res.label.findpwd", "subject"), new Object[] { Global.AppName });
  66. String content = StrUtil.format(SkinUtil.LoadString(request, "res.label.findpwd", "content"), new Object[] { user.getRawPwd() }); // "您的密码为:" + user.getRawPwd();
  67. sendmail.initMsg(to, senderName, subject, content, true);
  68. // out.print(to + " " + mailserver + " " + smtp_port + " " + smtpname + " " + pwd_raw + " senderName=" + senderName + " Global.email=" + Global.email + subject + " " + content);
  69. if ( sendmail.send())
  70. out.println(SkinUtil.makeInfo(request, SkinUtil.LoadString(request, "res.label.findpwd", "sended") + to));
  71. else
  72. {
  73.     out.println(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "res.label.findpwd", "fail_reason") + sendmail.getErrMsg()));
  74. }
  75. sendmail.clear();
  76. return;
  77. }
  78. else {
  79. out.print(StrUtil.Alert(SkinUtil.LoadString(request, "res.label.findpwd", "err_answer")));
  80. }
  81. }
  82. %>
  83. <p>&nbsp;</p>
  84. <table width="46%" height="155"  border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="<%=skin.getTableBorderClr()%>">
  85.   <tr>
  86.     <td height="26" align="center" background="forum/<%=skinPath%>/images/bg1.gif" class="text_title">
  87. <lt:Label res="res.label.findpwd" key="answer_question"/></td>
  88.   </tr>
  89.   <tr>
  90.     <td><table width="88%" border="0" align="center" cellpadding="1" cellspacing="0" class="p9">
  91.       <form name=form1 action="findpwd2.jsp" method="post" onSubmit="return form1_onsubmit()">
  92.         <tr>
  93.           <td height="22" align="center"><lt:Label res="res.label.findpwd" key="user_name"/></td>
  94.           <td height="22"><%=name%><input name="name" type=hidden value="<%=name%>"></td>
  95.         </tr>
  96.         <tr>
  97.           <td height="22" align="center"><lt:Label res="res.label.findpwd" key="question"/></td>
  98.           <td height="22"><%=user.getQuestion()%></td>
  99.         </tr>
  100.         <tr>
  101.           <td width="28%" height="22" align="center"><lt:Label res="res.label.findpwd" key="answer"/></td>
  102.           <td width="72%" height="22"><input name="answer" style="width:120">
  103.             &nbsp;</td>
  104.         </tr>
  105.         <tr align="center">
  106.           <td height="35" colspan="3"><input type=submit value="<lt:Label key="ok"/>">
  107.     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
  108.         </tr>
  109.       </form>
  110.     </table></td>
  111.   </tr>
  112. </table>
  113. <p>&nbsp;</p>
  114. <%@ include file="forum/inc/footer.jsp"%>
  115. </body>
  116. <script language="javascript">
  117. <!--
  118. function form1_onsubmit()
  119. {
  120. errmsg = "";
  121. if (form1.answer.value=="")
  122. errmsg += "<lt:Label res="res.label.findpwd" key="need_answer"/>n"
  123. if (errmsg!="")
  124. {
  125. alert(errmsg);
  126. return false;
  127. }
  128. }
  129. //-->
  130. </script>
  131. </html>