<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ADAuth.aspx.cs" Inherits="SmartLogonServer.ADAuth" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="Content/jquery-1.9.1.min.js"></script>
<link href="Bootstrap/css/bootstrap.min.css" rel="stylesheet"/> 
    <link href="Content/toastr/toastr.min.css"  rel="stylesheet" />
<script src="Bootstrap/js/bootstrap.min.js"></script>

            <script src="Content/toastr/toastr.min.js"></script>
        <script src="Content/sweetalert/sweetalert.min.js"></script>
    <title></title>
</head>
<body>
     <div class="panel-body" style="padding-bottom:0px;">
                             <div class="row" style="padding:10px;">
                        <div class="col-md-2"></div>
                        <div class="col-md-4">
                            终端计算机可以自己修改域密码，但是必须需要得到授权，此处可以输入域服务器的管理员用户名和密码，当终端客户使用修改域密码工具修改密码时，将会使用这里的授权进行域密码的更改，同时修改登录系统的密码。<br/>这个授权用户名和密码将以密文的方式保存，不用担心泄露。
                        </div>
                    </div>
      
                    <div class="row" style="padding:10px;">
                        <label class="control-label col-md-2">域管理员用户名</label>
                        <div class="col-md-4">
                            <input type="text" name="edtUserOldPwd" id="edtUserOldPwd" class="form-control" placeholder="用户名"/>
                        </div>
                    </div>
                    <div class="row" style="padding:10px;">
                        <label class="control-label col-md-2">域管理员密码</label>
                        <div class="col-md-4">
                           <input type="password" name="edtUserPwd1" id="edtUserPwd1" class="form-control" placeholder="密码"/>
                        </div>
                    </div>
                       <div class="row" style="padding:10px;">
                        <label class="control-label col-md-2">域管理员重复密码</label>
                        <div class="col-md-4">
                           <input type="password" name="edtUserPwd2"  id="edtUserPwd2" class="form-control" placeholder="密码"/>
                        </div>
                    </div>
                    
                     <div class="row" style="padding:10px;">
                      <div class="col-md-2"></div>
                        <div class="col-md-4">
                            <button type="button" id="btn_changepwdsave" class="btn btn-primary col-md-4">授权</button>
                        </div>
                    </div>
         </div>


    <script type="text/javascript">
        $("#btn_changepwdsave").on('click', function () {
            //弹出模态框
           

            var userold= $("#edtUserOldPwd").val().trim();
            var userpwd1 = $("#edtUserPwd1").val();
            var userpwd2 = $("#edtUserPwd2").val();


            if ((userpwd1 != userpwd2) || (userpwd1 == "")) {
                toastr.error("两次密码必须相同并且不为空!");
                return;
            }


            $.ajax({
                type: "post",
                url: "ADAuthEdit.ashx",
                data: {
                    userold: userold,
                    userpwd1: userpwd1

                },
                dataType: 'JSON',
                success: function (data, status) {

                    if (status == "success") {
                        if (data.result == true) {
                            toastr.success('修改域授权密码成功');
                        }
                        else {
                            toastr.error('修改域授权密码失败');
                        }
                    }
                },
                error: function () {
                    toastr.error('修改域授权密码失败');
                },
                complete: function () {

                }

            });

            //给弹出框里面的各个文本框赋值
            $("#edtUserPwd1").val();
            $("#edtUserPwd2").val();
            $("#edtUserOldPwd").val();

        });

        toastr.options.positionClass = 'toast-top-center';
</script>
</body>
</html>
