⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modi_security_info.jsp

📁 计算机技术的快速发展
💻 JSP
字号:
<%@page contentType="text/html; charset=gb2312" language="java" errorPage="error.jsp"%>
<%@page import="com.suninformation.*,com.suninformation.user.*,com.suninformation.tools.*,java.sql.Date"%>
<%request.setCharacterEncoding("gb2312");%>
<%
  String UserName = ParamUtils.getParameter(request, "username");
  String sessionUserName = (String) session.getAttribute("userName");
  int Type = ParamUtils.getIntParameter(request, "type", 2);
  //boolean Setupsecurity = ParamUtils.getBooleanParameter(request, "setupsecurity", false);
  String Password = null;
  String Question = null;
  String Answer = null;
  String SecurityCode = null;
  String Email = null;
  boolean errorLogin = true;
  boolean errors = false;
  boolean errorQuestion = false;
  boolean errorAnswer = false;
  boolean errorSecurityCode = false;
  boolean errorPassword = false;
  boolean errorEmail = false;
  boolean succ = false;
  //用户是否登陆了。{
  if ("null".equals(UserName)) {
    UserName = null;
  }
  if (UserName != null && sessionUserName != null) {
    if (UserName.equals(sessionUserName)) {
      errorLogin = false;
    }
    else {
      errorLogin = true;
    }
  }
  if (errorLogin) {
    throw new UserNotFoundException("): Sorry,您可能还未登陆或已经超时了!<br>请重新<a href=\"login.jsp\">登陆</a>。");
  }
  User us = UserManager.getUserProxy().getUser(UserName);
  //页面处理部分
  if (request.getMethod().equals("POST")) { //判断是否是非法进入
    if (Type == 2) {
      SecurityCode = ParamUtils.getParameter(request, "securitycode");
      String errMsg = "<ui>";
      if (SecurityCode == null || SecurityCode.length() > 16) {
        errorSecurityCode = true;
      }
      errors = errorSecurityCode;
      if (!errors) {
        SecurityInfo si = UserManager.getUserProxy().getSecurityInfoProxy().getSecurityInfo(UserName);
        if (CheckValue.md5(SecurityCode).equals(si.getSecurityCode())) {
          Question = si.getQuestion();
          Answer = si.getAnswer();
          Email = si.getSecurityEmail();
          Type = 3;
        }
        else {
          throw new UnacceptableException("安全码不正确。");
        }
      }
      if (errors) {
        if (errorSecurityCode) {
          errMsg = errMsg + "<li>安全码输入错误。</li>";
        }
        errMsg = errMsg + "</ui>";
        throw new UnacceptableException(errMsg);
      }
    }
    else if (Type == 3) {
      Question = ParamUtils.getParameter(request, "question");
      Answer = ParamUtils.getParameter(request, "answer");
      Email = ParamUtils.getParameter(request, "email");
      String errMsg = "<ui>";
      if (Question == null || Question.length() > 30) {
        errorQuestion = true;
      }
      if (Answer == null || Answer.length() > 30) {
        errorAnswer = true;
      }
      if (Email == null || Email.indexOf("@") < 1 || Email.indexOf(".") < 1 || Email.length() > 50) {
        errorEmail = true;
      }
      errors = errorQuestion || errorEmail || errorAnswer;
      if (!errors) {
        SecurityInfo si = UserManager.getUserProxy().getSecurityInfoProxy().getSecurityInfo(UserName);
        si.setAnswer(Answer);
        si.setQuestion(Question);
        si.setSecurityEmail(Email);
        si.save();
        succ = true;
      }
      if (errors) {
        if (errorEmail) {
          errMsg = errMsg + "<li>电子邮件输入错误。</li>";
        }
        if (errorQuestion) {
          errMsg = errMsg + "<li>提示问题输入错误。</li>";
        }
        if (errorAnswer) {
          errMsg = errMsg + "<li>问题答案输入错误。</li>";
        }
        errMsg = errMsg + "</ui>";
        throw new UnacceptableException(errMsg);
      }
    }
  }
%>
<html>
<head>
<title>modi_security_info</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body bgcolor="#ffffff">


<%if (Type == 2) {          %>
          <form action="" method="post" name="frmUserReg" id="frmUserReg">
            <table width="652" height="24" border="0" cellpadding="0" cellspacing="0" class="td_downLine">
              <tr>
                <td width="15" class="td_downLine">&nbsp;</td>
                <td width="282" class="td_downLine">
                  <img src="Images/arrow_04.gif" width="7" height="7">
                  安全设置身份验证
</td>
                <br>
              </tr>
            </table>
            <table width="652" border="0" align="center" cellpadding="2" cellspacing="2">
              <tr>
                <td width="89" align="right" class="td_downLine">安全码:</td>
                <td width="183" class="td_downLine">
                  <input name="securitycode" type="password" id="securitycode" maxlength="16" style="FONT-SIZE: 12px; WIDTH: 90">
                </td>
                <td width="360" class="td_downLine">
                  <table width="354" height="25" border="0" cellpadding="1" cellspacing="1">
                    <tr>
                      <td width="5" bgcolor="#999999">                      </td>
                      <td width="342">为了安全,我们必须确认您的身份,请输入您的安全码。</td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr>
                <td align="right">
                  <input name="type" type="hidden" id="type" value="2">
                </td>
                <td>
                  <input name="btn_ok2" type="submit" id="btn_ok2" style="FONT-SIZE: 12px; WIDTH: 80px" value="确定">
                  <input name="btn_no2" type="reset" id="btn_no" style="FONT-SIZE: 12px; WIDTH: 60px" value="重填">
                </td>
                <td>&nbsp;</td>
              </tr>
            </table>
          </form>
          <%} else if (Type == 3 && !succ) {          %>
          <form action="" method="post" name="frmUserReg" id="frmUserReg">
            <table width="652" heigh?晩?牥潲獲t="24" border="0" cellpadding="0" cellspacing="0" class="td_downLine">
              <tr>
                <td width="15" class="td_downLine">&nbsp;</td>
                <td width="282" class="td_downLine">
                  <img src="Images/arrow_04.gif" width="7" height="7">
                  修改安全设置信息(下面各项必须全部填写)
</td>
                <br>
              </tr>
            </table>
            <table width="652" border="0" align="center" cellpadding="2" cellspacing="2">
              <tr>
                <td width="89" align="right">提示问题:</td>
                <td width="183">
                  <input name="question" type="text" id="question" style="FONT-SIZE: 12px; WIDTH: 150" value="<%=Question==null?"":Question%>" maxlength="30">
                </td>
                <td width="360" rowspan="2" class="td_downLine">
                  <table width="354" border="0" cellspacing="1" cellpadding="1">
                    <tr>
                      <td width="5" bgcolor="#999999">                      </td>
                      <td width="342">                        用于修复登录密码。如果您忘记了登录密码,可以非常方便地通过您的生日和密码提示问题/答案来重新设定密码。长度不超过30个字符。
                        <br>
                        <strong>
                          <font color="#FF0000">特别提醒:为了保障帐户的安全,请确保您设置的密码提示问题和答案便于记忆并且不易被他人猜出,问题和答案要设置得巧妙一点。一般来说,问题和答案最好是南辕北辙、毫无联系。</font>
                        </strong>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr>
                <td align="right" class="td_downLine">问题答案:</td>
                <td class="td_downLine">
                  <input name="answer" type="text" id="answer" style="FONT-SIZE: 12px; WIDTH: 150" value="<%=Answer==null?"":Answer%>" maxlength="30">
                </td>
              </tr>
              <tr>
                <td align="right" class="td_downLine">保密邮件:</td>
                <td class="td_downLine">
                  <input name="email" type="text" id="email" style="?晩?牥潲獲FONT-SIZE: 12px; WIDTH: 150px" value="<%=Email==null?"":Email%>" maxlength="50">
                </td>
                <td class="td_downLine">
                  <table width="354" border="0" cellspacing="1" cellpadding="1">
                    <tr>
                      <td width="5" bgcolor="#999999">                      </td>
                      <td width="342">用于修复登录密码。如果您忘记了登录密码,可以通过这个邮箱收到可重新设定登录密码的专用邮件,安全方便。</td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr>
                <td align="right">
                  <input name="type" type="hidden" id="type" value="3">
                </td>
                <td>
                  <input name="btn_ok22" type="submit" id="btn_ok22" style="FONT-SIZE: 12px; WIDTH: 80px" value="确定">
                  <input name="btn_no22" type="reset" id="btn_no2" style="FONT-SIZE: 12px; WIDTH: 60px" value="重填">
                </td>
                <td>&nbsp;</td>
              </tr>
            </table>
          </form>
          <%} else if (succ) {          %>
            <table width="74%" border="0" cellpadding="1" cellspacing="1">
              <tr>
                <td width="2%" height="22" class="td_downLine">&nbsp;</td>
                <td width="74%" class="td_downLine">                  &nbsp;
                  <img src="Images/arrow_04.gif" width="7" height="7">
                  <strong>系统消息:</strong>
                </td>
                <td width="24%" class="td_downLine">&nbsp;</td>
              </tr>
              <tr>
                <td class="td_downLine">&nbsp;</td>
                <td class="td_downLine">
                  <p>用户安全信息修改/设置成功了!现在您可以:</p>
                  <ul>
                    <li><a href="main.jsp?username=<%=UserName%>">返回PersonHome!</a></li>
                  </ul>
                </td>
                <td valign="top" class="td_downLine">
                  <img src="Images/succ.gif" width="95" height="97">
                </td>?晩?牥潲獲
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td align="center">&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table>
          <%}          %>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -