<%@include file="/auth.jsp"%>
<%@ page language="java" pageEncoding="utf-8" %>

<script>
	function check()
	{
		if(document.form1.old_pwd.value == null || document.form1.old_pwd.value == "")
		{
			alert("原登录口令不能为空!");
			document.form1.old_pwd.focus();
			return false;
		}

		if(document.form1.new_pwd.value == null || document.form1.new_pwd.value == "")
		{
			alert("新登录口令不能为空!");
			document.form1.new_pwd.focus();
			return false;
		}

		if(document.form1.au_pwd.value == null || document.form1.au_pwd.value == "")
		{
			alert("口令确认不能为空!");
			document.form1.au_pwd.focus();
			return false;
		}
    
		if(document.form1.new_pwd.value != document.form1.au_pwd.value)
		{
			alert("新登录口令的口令确认没有通过!");
			document.form1.au_pwd.value = "";
			document.form1.au_pwd.focus();
			return false;
		}
		if(document.form1.old_pwd.value ==document.form1.new_pwd.value ){
			
			if (!confirm("新口令和旧口令相同是否要修改?")) {
				return false;
			}
		}
		if (!confirm("你确定要修改密码吗?")) {
			return false;
		}
        form1.submit();		
		return true;
	}
	function aut()
	{
		if(document.form1.new_pwd.value.length == 0) return;
		if(document.form1.au_pwd.value.length == 0) return;

		if(document.form1.new_pwd.value != document.form1.au_pwd.value)
		{
			alert("新口令验证不通过!");
			document.form1.au_pwd.value = '';
			document.form1.au_pwd.focus();
		}
	}
</script>
<html>
<link href="/css/font.css" rel="stylesheet" type="text/css">
<script src="/js/check.js"></script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.tbHead {	background-color: #98C5EC;
	font-size: 12px;
	color: #333333;
	padding: 3px;
	text-align: center;
}
.tbHead2 {	background-color: #F6FBFF;
	font-size: 12px;
	color: #333333;
	padding: 1px;
	text-align: center;
}
.tbListWhite {	background-color: #FFFFFF;
	font-size: 12px;
	color: #333333;
	padding: 1px;
}
-->
</style>
<body>
		<br>
<table width="90%"  border="0" align="center" cellpadding="0" cellspacing="1" class="box">
  <tr>
    <td valign="top"><table width="100%" height="23"  border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="25%" background="/images/tab_search_01.jpg"><table width="80%" height="23" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="3%"><img src="/images/little_red.jpg" width="12" height="12"></td>
                <td width="97%" class="font12b">&nbsp;修改密码</td>
              </tr>
          </table></td>
          <td width="82%" background="/images/tab_search_03.jpg"><img src="/images/tab_search_02.jpg" width="12" height="23"></td>
        </tr>
      </table>                     
	<p align="center"><font size="2" color='red'>(如果是默认口令在办理业务的时候会自动切换到该页面,请务必修改口令)</font></p>
	<form name="form1" action="/chg_pwd.jsp" method="post" >
   <table width="90%"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="d8e9fe" class="table02">
      	   <tr bgcolor="#FFFFFF">
				<td  class="cell1">
					原口令
				</td>
				<td class="cell2">
					<input name='old_pwd' type="password" maxlength="10">
				</td>
			</tr>
			<tr bgcolor="#FFFFFF">
				<td class="cell1">
					新口令
				</td>
				<td class="cell2">
					<input name='new_pwd' type="password" maxlength="10">
				</td>
			</tr>
			<tr bgcolor="#FFFFFF">
				<td class="cell1">
					口令确认
				</td>
				<td class="cell2">
					<input name='au_pwd' type="password" maxlength="10" onblur="aut();">
				</td>
			</tr>
		</table>
		<br>
		<table width='90%'  border='0' align='center' cellpadding='0' cellspacing='0'>
			<tr>
				<td align='center'>
					<input  class="box_button" type="button" name="button"  value=" 确定 "  onclick="return check();">
				</td>
			</tr>
		</table>
		<br>
		<center>

<%
	String ls_oldpwd = "",ls_newpwd = "",ls_errorinfo = "";
	ls_oldpwd = request.getParameter("old_pwd");
	ls_newpwd = request.getParameter("new_pwd");

	if(ls_oldpwd == null || ls_oldpwd.equals(""))
	{}
	else
	{

		String ls_url = "",outstr = "";
		String ls_rtn = login_obj.modiPwd(ls_oldpwd,ls_newpwd);
	
		if(ls_rtn != "")
		{
			out.println("<font color='red'>修改口令失败,失败原因:" + ls_rtn + "</font>");
		}
		else
		{

			out.println("<font color='blue'>修改口令成功" + "</font>");
			//login_obj.optrpwd = login_obj.encrypt_optr_password(ls_newpwd);
			//session.setAttribute("login",login_obj);
		}
	}
%>

</center>

	</form>
	 </td>
  </tr>
</table>

<%@include file="foot.jsp"%>

</body>
</html>