{% load i18n %}
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <title>修改密码</title>
    <!-- css -->
    <link href="{{ STATIC_URL }}manage/css/base.css" rel="stylesheet">
</head>
<body>
<!-- 页面加载中动画 -->
<div id="page-loading">
    <img class="loading" alt="" src="{{ STATIC_URL }}manage/images/page-loading.svg">
</div>
<!-- 网络请求加载动画 -->
<div class="ajax-loading">
    <div class="loading-bg">
        <img class="loading" alt="" src="{{ STATIC_URL }}manage/images/loading.svg">
    </div>
</div>
<!-- 自动消失的提示 -->
<div class="m-pop" id="m-pop">
    <div class="pop-msg"></div>
</div>
<div class="m-pop" id="m-pop-error">
    <div class="pop-msg error"></div>
</div>
<div class="page">
    <div class="page-header">
        <p class="page-title">修改密码</p>
    </div>
    <div class="page-body">
        <form id="fm" class="form-inline" action="{% url 'manage_reset_password' %}" method="post">
            {% csrf_token %}
            <div class="form-group">
                <label>旧密码</label>
                <input class="form-control" name="old_password" type="password"/>
            </div>
            <div class="form-group">
                <label>新密码</label>
                <input class="form-control" name="new_password" type="password"/>
            </div>
            <div class="form-group">
                <label>确认密码</label>
                <input class="form-control" name="new_password2" type="password"/>
            </div>
            <div class="form-action">
                <input type="submit" value="提交" class="button button-brand" id="submit"/>
            </div>
        </form>
    </div>
</div>
<!-- js -->
<script src="{{ STATIC_URL }}vender/jquery/jquery-1.12.4.min.js"></script>
<script src="{{ STATIC_URL }}manage/js/utils.js"></script>
<script>
    window.onload = function () {
        setTimeout(function () {
            document.getElementById("page-loading").style.display = "none";
        }, 500);
    }
    $(function () {
        var csrf_token = '{{ csrf_token }}',
            fm = '#fm';
        $(document).on("click", "#submit", function (e) {
            e.preventDefault();
            var action = $(fm).attr('action');
            var data = getFormParams(fm);
            data['csrfmiddlewaretoken'] = csrf_token;
            post(action, data, function (result) {
                if (result.errcode == 200) {
                    showMsg('操作成功');
                    $(fm).form('clear');
                } else {
                    showMsg(result.errmsg);
                }
            });
        });
    });
</script>
</body>
</html>