<!--{include file="<!--{$oapath}-->public/ins_popup.tpl"}-->
<block name="content">
	<div class="page-header">
            <h1>修改密码</h1>
        </div>
	<form id="form_password" method="post" action="" class="well form-horizontal">
		<input type="hidden" name="ajax" id="ajax" value="1">
		<input type="hidden" name="user_id" id="user_id" value="<!--{$id}-->">
		<div class="form-group">
			<label class="col-xs-2 control-label" >新密码：</label>
			<div class="col-xs-10">
				<input type="password" name="password" id="password" value=""  class="form-control col-20">
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-2 control-label" >确认密码：</label>
			<div class="col-xs-10">
				<input type="password" name="confirm_password" id="confirm_password" value=""  class="form-control col-20"/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-2 control-label" ></label>
			<div class="col-xs-10">
				<p class="form-control-static">
					<span id="msg" ></span>
				</p>
			</div>
		</div>
		<div class="form-group">
			<div class="action  col-xs-10 col-xs-offset-2">
				<input class="btn btn-sm btn-primary" type="button" value="保存" onclick="save();">
				<input  class="btn btn-sm " type="button" value="取消" onclick="myclose();">
			</div>
		</div>
	</form>
</block>

                                		</div>
		<!-- Mainly scripts -->
		<script src="<!--{$oapath}-->Ins/js/jquery-2.1.1.js"></script>
		<script src="<!--{$oapath}-->Ins/js/bootstrap.min.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/metisMenu/jquery.metisMenu.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
		<!-- Custom and plugin javascript -->
		<script src="<!--{$oapath}-->Ins/js/inspinia.js"></script>
		<script src="<!--{$oapath}-->Ins/js/common.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/pace/pace.min.js"></script>
                
		<script src="<!--{$oapath}-->Ins/js/plugins/toastr/toastr.min.js"></script>
                <script src="<!--{$oapath}-->Ins/js/plugins/gritter/jquery.gritter.min.js"></script>
                <script src="<!--{$oapath}-->Ins/js/plugins/bootbox/bootbox.min.js"></script>
                                <script src="<!--{$oapath}-->Ins/js/plugins/date-time/moment-with-locales.js"></script>
	        <script src="<!--{$oapath}-->Ins/js/plugins/date-time/bootstrap-datetimepicker.js"></script>
		<block name="js"></block>
		<script>
			$(document).ready(function() {
				$(".popup-container").width($("#dialog", parent.document).width());
				if (is_mobile()) {
					$(".popup-container").height(window.screen.height - 40);
					$(".popup-container").css('overflow', 'auto');
				}
			});
		</script>
<block name="js">
	<script type="text/javascript">
		function check_password(s) {
			if (s.length < 4) {
				return 0;
			}
			var ls = 0;
			if (s.match(/[a-z]/ig)) {
				ls++;
			}
			if (s.match(/[0-9]/ig)) {
				ls++;
			}
			if (s.match(/(.[^a-z0-9])/ig)) {
				ls++;
			}
			if (s.length < 6 && ls > 0) {
				ls--;
			}
			return ls;
		}

		function save() {
			var msg = "";
			var vars = $("#form_password").serialize();
			new_pwd = $("#password").val();
			confirm_pwd = $("#confirm_password").val();
			if (new_pwd == confirm_pwd) {
				sendAjax("oa.php?c=User&a=reset_pwd", vars, function(data) {
                                    if(data.status=='1'){
                                        ui_info(data.info);
					setTimeout("myclose()", 800);
                                    }else{
                                        ui_error(data.info);
                                    }
					
				});
			} else {
				ui_error("密码不一致");
			}
		}

		$(document).ready(function() {
			$("#password").keydown(function() {
				s = $(this).val();
				t = check_password(s);
				if (t == 0) {
					$("#msg").html("密码过短");
					$("#msg").css("color", "red");
				}
				if (t == 1) {
					$("#msg").html("密码强度差");
					$("#msg").css("color", "red");
				}
				if (t == 2) {
					$("#msg").html("密码强度良好");
					$("#msg").css("color", "blue");
				}
				if (t == 3) {
					$("#msg").html("密码强度高");
					$("#msg").css("color", "blue");
				}
			});
			$("#confirm_password").keyup(function() {
				new_pwd = $("#password").val();
				confirm_pwd = $(this).val();
				if (new_pwd != confirm_pwd) {
					$("#msg").html("密码不一致");
					$("#msg").css("color", "red");
				} else {
					$("#msg").html("密码一致");
					$("#msg").css("color", "blue");
				}
			});
		});
	</script>
</block>
	</body>
</html>