📄 recover_pwd_method1.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");%>
<html>
<head>
<title>找回密码 - 沈航网络</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Includes/user.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-image: url(Images/bg.jpg);
}
body,td,th {
font-size: 12px;
}
-->
</style>
<link href="Includes/im.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<%
String UserName = ParamUtils.getParameter(request, "username");
//String sessionUserName = (String) session.getAttribute("userName");
//boolean errorLogin = true;
String errMsg = "<ui>";
boolean Recover = ParamUtils.getBooleanParameter(request, "recover", false);
int Step = ParamUtils.getIntParameter(request, "step", -1);
Date Birthday = null;
String Question = null;
String Answer = null;
String NewPassword = null;
String NewPassword2 = null;
boolean errorBirthday = false;
boolean errorUserName = false;
boolean errorAnswer = false;
boolean errorNewPassword = false;
boolean errorNewPassword2 = false;
boolean errorPasswordMatch = false;
boolean errors = 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>。");
}
*/
//页面处理部分
if (Recover && request.getMethod().equals("POST")) {
if (Step == 1) {
int Birthday_Year = ParamUtils.getIntParameter(request, "birthday_year", -1);
int Birthday_Month = ParamUtils.getIntParameter(request, "birthday_month", -1);
int Birthday_Day = ParamUtils.getIntParameter(request, "birthday_day", -1);
Birthday = CheckValue.isSQLDate(Birthday_Year, Birthday_Month, Birthday_Day);
if (UserName == null || UserName.length() < 3 || UserName.length() > 16) {
errorUserName = true;
}
if (Birthday == null) {
errorBirthday = true;
}
errors = errorUserName || errorBirthday;
if (!errors) {
try {
SecurityInfo si = UserManager.getUserProxy().getSecurityInfoProxy().getSecurityInfo(UserName);
if(Birthday.toString().equals(UserManager.getUserProxy().getUserInfoProxy().getUserInfo(UserName).getBirthday().toString())) {
Question = si.getQuestion();
}else {
throw new UnacceptableException("出生日期不正确。");
}
}
catch (UserNotFoundException e) {
throw new UserNotFoundException("您可能尚未进行过安全设置。");
}
}
if (errors) {
if (errorUserName) {
errMsg = errMsg + "<li>用户名有误,请重新输入。</li>";
}
else if (errorBirthday) {
errMsg = errMsg + "<li>出生日期输入有误。</li>";
}
errMsg = errMsg + "</ui>";
throw new UnacceptableException(errMsg);
}
}
else if (Step == 2) {
Answer = ParamUtils.getParameter(request, "answer");
NewPassword = ParamUtils.getParameter(request, "newpassword");
NewPassword2 = ParamUtils.getParameter(request, "newpassword2");
if (Answer == null) {
errorAnswer = true;
}
if (NewPassword == null || NewPassword.length() < 6 || NewPassword.length() > 16) {
errorNewPassword = true;
}
if (NewPassword2 == null || NewPassword2.length() < 6 || NewPassword2.length() > 16) {
errorNewPassword2 = true;
}
if (!errorNewPassword && !errorNewPassword2) {
if (!NewPassword.equals(NewPassword2)) {
errorPasswordMatch = true;
}
}
errors = errorAnswer || errorNewPassword || errorNewPassword2 || errorPasswordMatch;
if (!errors) {
try {
SecurityInfo si = UserManager.getUserProxy().getSecurityInfoProxy().getSecurityInfo(UserName);
if (Answer.equals(si.getAnswer())) {
UserManager.getUserProxy().getUser(UserName).setPassword(NewPassword2);
succ = true;
}
else {
throw new UnacceptableException("问题回答的不正确。");
}
}
catch (UserNotFoundException e) {
throw new UserNotFoundException("该用户不存在。");
}
}
if (errors) {
if (errorAnswer || errorNewPassword || errorNewPassword2) {
errMsg = errMsg + "<li>表单填写有误,请重新输入。</li>";
}
else if (errorPasswordMatch) {
errMsg = errMsg + "<li>重复密码与密码不一致。</li>";
}
errMsg = errMsg + "</ui>";
throw new UnacceptableException(errMsg);
}
}
}
%>
<TABLE WIDTH=776 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD width="10" ROWSPAN=2> </TD>
<TD><IMG SRC="Images/WEB_Page1_14.jpg" WIDTH=766 HEIGHT=9 ALT=""></TD>
</TR>
<TR>
<TD background="Images/WEB_Page1_15.jpg"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" align="right"><font color="#747474"><a href="http://www.aoke2008.com" class="title">沈航首页</a>| <a href="#" class="title" onClick="JavaScript:window.external.addFavorite('http://www.aoke2008.com/','奥克资讯网');return false;">加入收藏</a> | <a href="#" class="title" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.aoke2008.com/')">设为首页</a> | 网站导航</font></td>
<td width="29"> </td>
</tr>
<tr>
<td width="19" valign="top"> </td>
<td width="213" valign="top"><img src="Images/111.jpg" width="188" height="73"><br>
</td>
<td width="505" valign="baseline"><table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td align="center"><a href="login.jsp" class="title">用户登陆</a> - <a href="register.jsp" class="title">注册新用户</a> - <a href="recover_pwd.jsp" class="title">取回密码</a> </td>
</tr>
</table></td>
<td valign="top"> </td>
</tr>
</table></TD>
</TR>
</table>
<TABLE WIDTH=776 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD width="10" ROWSPAN=2> </TD>
<TD><IMG SRC="Images/WEB_Page1_14.jpg" WIDTH=766 HEIGHT=9 ALT=""></TD>
</TR>
<TR>
<TD background="Images/WEB_Page1_15.jpg">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"> </td>
<td width="29"> </td>
</tr>
<tr>
<td width="17" height="159" valign="top"> </td>
<td width="720" align="center" valign="top">
<table width="555" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="555" align="center">
<br>
<%if(!request.getMethod().equals("POST")) {%>
<table width="90%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="9%" class="td_downLine"> </td>
<td width="91%" class="td_downLine">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -