<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="passwordModify.aspx.cs"
    Inherits="Czou2012.UI.Manager.AdminUser.passwordModify" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>密码修改</title>

    <link rel="stylesheet" type="text/css" href="../Styles/style.css" />
    <link rel="stylesheet" type="text/css" href="../Scripts/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../Scripts/themes/icon.css" /> 
    
    <script type="text/javascript" src="../Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.validate.field.js"></script>

    <link type="text/css" rel="stylesheet" href="../Scripts/Tips/tip-yellowsimple/tip-yellowsimple.css" />
    <script type="text/javascript" src="../Scripts/Tips/jquery.poshytip.js"></script>

    <script type="text/javascript">
    //修改密码
    function btnPasswordModify() {
        var oldPassword = $.trim($('#oldPassword').val());
        var newPassword = $.trim($('#newPassword').val());
        var confirmPassword = $.trim($('#confirmPassword').val());

        var msg = $.ValidateField.ValidatePassword(oldPassword);
        if (msg != $.ValidateField.OK) {
            msg = "(" + msg + ")";
            $('#lblInfo').html(msg);
            $('#oldPassword').focus();
            $('#oldPassword').select();
            return;
        } else { $('#oldPasswordInfo').html(""); }

        var msg = $.ValidateField.ValidatePassword(newPassword);
        if (msg != $.ValidateField.OK) {
            msg = "(" + msg + ")";
            $('#lblInfo').html(msg);
            $('#newPassword').focus();
            return;
        } else { $('#newPasswordInfo').html(""); }

        var msg = $.ValidateField.ValidatePassword(confirmPassword);
        if (msg != $.ValidateField.OK) {
            msg = "(" + msg + ")";
            $('#lblInfo').html(msg);
            $('#confirmPassword').focus();
            return;
        } else { $('#confirmPasswordInfo').html(""); }

        var msg = $.ValidateField.ValidateConfirmPassword(newPassword,confirmPassword);
        if (msg != $.ValidateField.OK) {
            msg = "(" + msg + ")";
            $('#lblInfo').html(msg);
            $('#confirmPassword').focus();
            $('#confirmPassword').select();
            return;
        } else {$('#confirmPasswordInfo').html("");}


        $.post('passwordModify.aspx?oldPassword=' + oldPassword + '&newPassword=' + newPassword + '&type=modify', function (returnMsg) {

            if (returnMsg == '4') {
                $('#lblInfo').html("原密码错误!");
                $('#oldPassword').val("");
                $('#oldPassword').focus();
                $('#oldPassword').select();
                return;
            }

            if (returnMsg == '1') {

                $('#lblInfo').html("修改成功,请记住您的新密码!");
                $('#oldPassword').val("");
                $('#newPassword').val("");
                $('#confirmPassword').val("");
                $.messager.alert("密码修改", "修改成功,请记住您的新密码!", "info");
                return;
            }

            if (returnMsg != '1' && returnMsg != '4') {
                $('#lblInfo').html("修改失败!");
                return;
            }
        })

    }

    $(function () {
        $('#oldPassword').focus();
        $('#oldPassword').select();
    });

    $(document).ready(function () {
        //设置不要在公共场所使用记住用户名Tips
        $('#newPassword,#confirmPassword').poshytip({
            className: 'tip-yellowsimple',
            showOn: 'focus',
            alignTo: 'target',
            alignX: 'right',
            alignY: 'center',
            offsetX: 5
        });

        $('#btnModify').linkbutton('<%=Czou2012.UI.Manager.CommonClass.OperatorRight.IsRightButton("enable","w")%>');    // disable the button  
       
    });
</script>
</head>

<body>
   <div id="modifyDiv" class="divRectangle ">
        <div class="divTitle  icon-save">修改密码&nbsp;&nbsp;<label id="lblInfo" class="labelInfo"></label></div>
        <div  style="clear:left;height:120px;text-align:left;padding:10px;padding-left:30px; background: #fff; border: 1px solid #ccc;">           
              <div class="row rowPassword"><label class="labelPassword">原 密 码：</label>                   
                        <input id="oldPassword" type="password" class="inputBg inputCellspace"  tabindex="1" onkeydown="javascript:if (event.keyCode == 13){btnPasswordModify();}"/>
                        <label id="oldPasswordInfo" class="labelInfo"></label>
               </div>
               <div class="row rowPassword"><label class="labelPassword">新 密 码：</label>
                        <input id="newPassword" type="password" class="inputBg inputCellspace" tabindex="2" onkeydown="javascript:if (event.keyCode == 13){btnPasswordModify();}"  title="3位以上字母和数字"/>
                        <label id="newPasswordInfo" class="labelInfo"></label>
               </div>
               <div class="row rowPassword"><label class="labelPassword">确认密码：</label>
                        <input id="confirmPassword" type="password" class="inputBg inputCellspace" tabindex="3" onkeydown="javascript:if (event.keyCode == 13){btnPasswordModify();}"  title="3位以上字母和数字"/>
                        <label id="confirmPasswordInfo" class="labelInfo"></label>
               </div>
        </div>
        <div style="text-align: center; height:35px;line-height:35px;margin-top: 10px;">
            <a id="btnModify" class="easyui-linkbutton" icon="icon-ok" href="javascript:btnPasswordModify()" tabindex="5">修改确认</a>
        </div>
    </div>
</body>
</html>
