{% extends 'base.html' %}


{% partialdef login-block %}
    Logging in here allows your account to be linked with CIMAR. You may periodically need to re-login to keep the link active.
    <form method="POST" class="post-form" id="cimar-login-form">
        Username: <input type="text" id="username" name="username" value=""/> <br/>
        Password: <input type="password" id="password" name="password" value=""/> <br/>
        <button hx-post='{% url "cimar_login" %}'
                hx-target="#results">Login</button>
    </form>

    <div id="results"></div>

{% endpartialdef %}


{% block content %}
    <div class="anatomy">


        <h2>CIMAR login</h2>
        Login status: {{ login_status }} ({{cimar_sid}})

        {% if login_status %}
            <button
                class="button btn-sm"
                hx-get="{% url 'cimar_logout' %}"
                hx-swap="outerHTML"
            >Logout</button>
        {% endif %}
        <br/>

        {% partial login-block %}

    </div>
{% endblock %}