{{{ template "common/header" . }}}
    <div class="ui small modal">
        <div class="header">修改密码</div>
        <div class="content">
            <form class="ui form">
                <div class="two fields">
                    <div class="field">
                        <label>原密码</label>
                        <input class="small input" type="password" name="old_password" placeholder="原密码">
                    </div>
                </div>
                <div class="two fields">
                    <div class="field">
                        <label>新密码</label>
                        <input type="password" name="new_password" placeholder="新密码">
                    </div>
                </div>
                <div class="two fields">
                    <div class="field">
                        <label>确认新密码</label>
                        <input type="password" name="confirm_new_password" placeholder="确认新密码">
                    </div>
                </div>
                <button class="ui button primary button" >登录</button>
            </form>
        </div>
    </div>

<script type="text/javascript">
    $('.ui.modal').modal('setting', 'closable', false).modal('show');
    $('.ui.form').form(
            {
                onSuccess: function(event, fields) {
                    util.post('/user/editPassword', fields, function(code, message) {
                        swal("操作成功", '修改成功', 'success');
                        location.href = "/task"
                    });

                    return false;
                },
                fields: {
                    oldPassword: {
                        identifier  : 'old_password',
                        rules: [
                            {
                                type   : 'empty',
                                prompt : '请输入原密码'
                            }
                        ]
                    },
                    newPassword: {
                        identifier  : 'new_password',
                        rules: [
                            {
                                type   : 'empty',
                                prompt : '请输入新密码'
                            }
                        ]
                    },
                    confirmNewPassword: {
                        identifier  : 'confirm_new_password',
                        rules: [
                            {
                                type   : 'match[new_password]',
                                prompt : '两次输入密码不匹配'
                            }
                        ]
                    }
                },
                inline : true
            });
</script>
{{{ template "common/footer" . }}}