@section styles{
    <style type="text/css">
        .layui-card {
            width: 100% !important;
            height: -webkit-calc(100vh - 25px);
            height: -moz-calc(100vh - 25px);
            height: calc(100vh - 25px);
        }
    </style>
}

<div class="layui-card">
    <div class="layui-card-header">修改密码</div>
    <div class="layui-card-body">
        <div class="layui-form" lay-filter="password-form">
            <div class="layui-form-item">
                <label class="layui-form-label">当前密码</label>
                <div class="layui-input-inline">
                    <input type="password" name="currentPassword" lay-verify="required" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">新密码</label>
                <div class="layui-input-inline">
                    <input type="password" name="newPassword" lay-verify="pass" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="pear-btn pear-btn-primary" lay-submit lay-filter="password_submit">提交</button>
                </div>
            </div>
        </div>
    </div>
</div>

@section scripts{
    <script type="text/javascript">
        layui.use(['abp', 'form'], function () {
            var $ = layui.jquery;
            var abp = layui.abp;
            var form = layui.form;

            form.on('submit(password-submit)', function (data) {
                var waitIndex = parent.layer.load(2);
                abp.ajax({
                    url: "@Url.Action("ChangePassword", "Users")",
                    data: JSON.stringify(data.field),
                    abpHandleError: false
                }).done(function (data) {
                    abp.notify.success(data.msg);
                }).fail(function (jqXHR) {
                    parent.layer.msg(jqXHR.message, { icon: 5 });
                }).always(function () {
                    parent.layer.close(waitIndex);
                });

                return false;
            });
        });
    </script>
}