<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <%@ include file="../../common/head.jsp"%>
</head>

<body>
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
            	 <cs:form_validate formId="setPwdForm"/>
                  <form class="form-horizontal" action="changePwd.cs" id="setPwdForm" method="POST">
                  <input type="hidden" value="${user.id}" name="id" id="id">
                       <div class="form-group">
                          <label class="col-sm-3 control-label">新密码：</label>
                          <div class="col-sm-4">
                              <input id="pwd" type="password"  name="pwd" class="form-control" validate="{required:true}" validateMessage="{required:'请输入密码'}" >
                          </div>
                      </div>
                      <div class="form-group">
                          <label class="col-sm-3 control-label">确认密码：</label>
                          <div class="col-sm-4">
                              <input id="confpwd" type="password"  name="confpwd" class="form-control" validate="{required:true,equalTo:'#pwd'}" validateMessage="{required:'请输入确认密码',equalTo:'密码与确认密码必须相同!'}" >
                          </div>
                      </div>
                      <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-3 pull-left">
                                    <button class="btn btn-default btn-dlg-close">取消</button>
                                    <button class="btn btn-primary btn-submit" type="submit">提交</button>
                                </div>
                       </div>
                      
                  </form>
            </div>
        </div>

    </div>


</body>
<script type="text/javascript">
    $(function(){
        $(".btn-submit").click(function(){
            if($("#setPwdForm").valid()){
                var targetForm=document.forms[0];
                $(targetForm).ajaxSubmit({
                    type:"post",
                    dataType:"json",
                    success:function(json){
                        $.tip("修改成功");
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.$('.active').remove();
                        parent.layer.close(index);
                    },
                    error:function(){
                        alert('error');
                    }
                });
            }
        });
    });
</script>
</html>

