<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">修改密码</a></li>
        @*<li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>*@
    </ul>
</div>
<div class="main">
    <form method="post" id="_form" class=" form  form-control-sm ui-validForm" data-validate-params="beforeSubmit:'BeforeSubmit'">
        <div class="form-group">
            <label class="control-label">旧密码</label>
            <div class="controls form-inline">
                <input type="password" class="form-control form-control-sm" name="oldPassword" id="oldPassword" data-validate="dataType:'*',nullMsg:'请填旧密码!',errorMsg:''" maxlength="16">
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">新密码</label>
            <div class="controls form-inline">
                <input type="password" class="form-control form-control-sm" name="newPassword" id="newPassword" data-validate="dataType:'password',nullMsg:'请填写新密码!',errorMsg:''" maxlength="16">
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">新确认密码</label>
            <div class="controls form-inline">
                <input type="password" class="form-control form-control-sm" name="password1" data-validate="dataType:'*',nullMsg:'请填写确认密码!',errorMsg:'两次密码输入不一致!',compare:'#newPassword'" maxlength="16">
                <span class="help-block"></span>
            </div>
        </div>

        <div class="postarea">
            <div class="form-group">
                <div class="controls">
                    @Html.AntiForgeryToken()
                    <button type="button" class="btn btn-sm  btn-primary ui-pagePost" data-custom-params="url:'@Url.Action()',callBack:'PostBack',successMsg:''">修改</button>
                    <a href="@Url.Action("Security")" class="btn btn-sm btn-default">返回</a>
                </div>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    function BeforeSubmit() {
        if ($("#oldPassword").val()== $("#newPassword").val()) {
            Alert("新密码不能和旧密码一样!")
            return false;
        }
        return true;
    }
    function PostBack() {
        Alert("密码修改成功!", { icon: 1 }, function () { location.href='@Url.Action("Security")'})
    }
</script>
