<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%>
<%@ include file="../common/common.jsp"%>
<title>账号信息</title>
</head>
<%@ include file="../common/head.jsp"%>
<body>
<div class="laymid">
	<div class="box mTop30">	
	<%@ include file="../common/left.jsp"%>
		<div class="mainBox">
			<div class="mainContent line">
				<div class="title-news">
					<h2 class="title">修改密码</h2>	
				</div>
				<form id="pwdModfiy">
					<ul class="ulFrm">
						<li>
							<span class="label labelW100 labelRight">公司名称：</span>
							<span class="middle red">${manager.nickName}</span>
						</li>
						<li>
							<span class="label labelW100 labelRight">当前登录密码：</span>
							<input type="password" class="text {text:'请输入当前登录密码'}" name="password" id="password" size="40" value="" />
						</li>
						<li>
							<span class="label labelW100 labelRight">输入新密码：</span>
							<input type="password" class="text {text:'请输入新的登录密码'}" name="new_password" id="new_password" size="40" value="" />
							<p class="p105 gray mTop5">必须是6-20位的字母、数字和下划线组成的密码，不能是纯数字</p>
						</li>
						<li>
							<span class="label labelW100 labelRight">重新输入新密码：</span>
							<input type="password" class="text {text:'请重新输入登录密码'}" name="confirm_password" id="confirm_password" size="40" value="" />
						</li>
					</ul>
				</form>
				<p align="center">
					<a href="javascript:saveNewPwd()" class="btn maxBtn btn-primary">保 存</a>
				</p>
			</div>
			
			<div class="clear"></div>
		</div>
	</div>
</div>
<%@ include file="../common/footer.jsp"%>
<script type="text/javascript">
$(function(){
	$.resetText();
	$(".text").input();
})

function saveNewPwd(){
	var new_password = $('#new_password').val();
	if($('#confirm_password').val() != new_password){
		alert("密码不一致。", 0, function(){});
		return;
	}
	if(new_password.isEmpty() || !/^[\w-_.]{6,16}$/i.test(new_password)){
		alert("请输入由6-20位的字母、数字和下划线组成的密码。", 0, function(){
			$("input[name='new_password']").focus();
		});
		return;
	}
	confirm("确认修改?",function(){
		var data ={"password" : $('#password').val(),"new_password":$('#new_password').val()};
		ajax("updatepassword.htm",data,function(res){
			if(res.code == 1)
				alert({title:"操作提示",nav:res.msg,flag:1,next:function(){
					window.location.href="logout.htm";
				}});
			else
				alert({title:"操作提示",nav:res.msg,flag:0,next:function(){
				}});
		});
	});
}
function checkPwd(pwd){
	if(!/^[\w-_.]{6,16}$/i.test(pwd)){
		alert("请输入由6-20位的字母、数字和下划线组成的密码。");
		return false;
	}
}
</script>
</body>
</html>