{% extends "myadmin/base.html" %}

{% block header %}
    <title>{{ _('修改密码') }}</title>
{% endblock %}

{% block content %}
    <div class="row header">
        <div class="col-sm-4">
            <h1>{{ _('修改密码') }}
                <small>{{ request.user.alias }}</small>
            </h1>
        </div>
    </div>

    <hr><br>

    <div class="row">
        <div class="col-sm-offset-3 col-sm-6">
            <form class="" action="/myadmin/admin/change_password" method="post" >
                {{ csrf_input }}
                <div class="form-group ">
                    <label>旧密码</label>
                    <input name="old_password" class="form-control" type="text" value="">

                </div>

                <div class="form-group ">
                    <label>新密码</label>
                    <input name="password" class="form-control" type="password" value="">

                </div>
                <div class="form-group ">
                    <label>确认密码</label>
                    <input name="password2" class="form-control" type="password" value="">

                </div>


                <div class="form-group">
                    <button type="submit" class="btn btn-default">提交</button>
                </div>
            </form>
        </div>
    </div>
    <script>
        $('form').ajaxForm({
            beforeSubmit:function(formData, jqForm, options){
                clearHelpText()
            },
            error: function (jqXHR, statusText, errorMsg) {
                ajaxError(jqXHR, statusText, errorMsg)
            },
            success: function (rsp) {
                if (rsp.code == 0) {
                    alertMsg(rsp.msg).time(3)
                    var win = window.parent || window
                    console.dir(win)
                    win.location.href='/myadmin/login'
                }else{
                    rsp.data ? addHelpText(rsp.data) : alertMsg(rsp.msg)
                }

            }
        })
    </script>
{% endblock %}