<?php include $this->admin_tpl('meta', 'admin');?>
<title>修改密码 - YzmCMS内容管理系统</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			 <li><label><span class="c-red">*</span>用户名：</label>
			 	<input type="text" class="input disabled" name="username" disabled="disabled" value="<?php echo $data['username']?>">
			 </li>
			 <li><label><span class="c-red">*</span>密码：</label>
			 	<input type="password" class="input" name="password" value="" placeholder="密码长度为6-20位">
			 </li>
			 <li><label><span class="c-red">*</span>确认密码：</label>
			 	<input type="password" class="input" name="password2" value="" placeholder="密码长度为6-20位">
			 </li>
		</ul>
		<div class="footer_btn">
			<input type="hidden" name="dosubmit" value="1">
			<input type="hidden" name="userid" value="<?php echo $userid?>">
			<input class="btn btn-primary radius" type="submit" value="提 交">
			<input class="btn btn-default radius" type="button" value="取 消" onclick="yzmcms_close()">	
		</div>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script type="text/javascript">
	function dosub(obj){
		 if(obj.password.value.length < 6 || obj.password.value.length > 20){
			 layer.msg('密码长度为6-20位！', {icon:2});
			 return false;
		 }
		 if(obj.password.value!=obj.password2.value){
			 layer.msg('两次密码不一致！', {icon:2});
			 return false;
		 }
        $.ajax({
            type: 'POST',
            url: '<?php echo U('password');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					layer.msg(msg.message, {icon:1, time:800}, function(){
						parent.location.reload();
					});
			    }else{
					layer.msg(msg.message, {icon:2});
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>