<div class="user-info">
    {% set username = session.get('username', '') %}
    <div class="user-avatar" onclick="toggleUserMenu()">
        <div class="avatar-circle">{{ username[:1].upper() }}</div>
        <span class="username">{{ username }}</span>
    </div>
    <div class="user-menu" id="userMenu">
        {% if username == 'admin' %}
        <div class="menu-item" onclick="goTo(`{{ url_for('log.log_list') }}`)">操作日志</div>
        {% endif %}
        <div class="menu-item" onclick="showChangePasswordModal()">修改密码</div>
        <div class="menu-item" onclick="logout()">注销登录</div>
    </div>
    <div class="modal" id="modal-password">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h3 class="modal-title">修改密码</h3>
                    <span class="close-btn" onclick="hide_modal('#modal-password')">&times;</span>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <div>
                            <label for="old_password">旧密码：</label>
                            <input type="password" id="old_password" class="form-control" required />
                        </div>
                        <div>
                            <label for="new_password">新密码：</label>
                            <input type="password" id="new_password" class="form-control" required />
                        </div>
                        <div>
                            <label for="confirm_password">确认密码：</label>
                            <input type="password" id="confirm_password" class="form-control" required />
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-success btn-large" onclick="changePassword()">保存</button>
                    <button class="btn btn-warning btn-large" onclick="hide_modal('#modal-password')">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>