tidy up some cimar stuff
This commit is contained in:
@@ -13,8 +13,17 @@ window.control_pressed = false;
|
||||
|
||||
$(document).ready(function () {
|
||||
document.body.addEventListener("htmx:responseError", function(e) {
|
||||
let error = e.detail.xhr.response;
|
||||
let el = document.getElementById("htmx-error");
|
||||
var error;
|
||||
if (e.detail.pathInfo.requestPath.includes("cimar") && e.detail.xhr.status == 403) {
|
||||
error = "Cimar permission error, please login and refresh the page.";
|
||||
//document.getElementById("cimar-login-form").focus();
|
||||
htmx.trigger("#cimar-login-needed", "cimar-login-needed");
|
||||
|
||||
|
||||
} else {
|
||||
error = e.detail.xhr.response;
|
||||
}
|
||||
el.innerHTML = error;
|
||||
el.classList.remove("hidden");
|
||||
});
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
{% if case.cimar_uuid %}
|
||||
|
||||
<details><summary>Details</summary>
|
||||
<br/>
|
||||
Case uuid: {{case.cimar_uuid}}
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -161,6 +161,13 @@
|
||||
<div class="row clear-both">
|
||||
<div class="col-md-12">
|
||||
<div id="htmx-error"></div>
|
||||
|
||||
<span
|
||||
id="cimar-login-needed"
|
||||
hx-get='{% url "cimar_status" %}'
|
||||
hx-trigger="cimar-login-needed from:body"
|
||||
>
|
||||
</span>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load partials %}
|
||||
|
||||
{% block content %}
|
||||
<div class="anatomy">
|
||||
|
||||
|
||||
<h2>CIMAR login</h2>
|
||||
Login status: {{ login_status }} ({{cimar_sid}})<br/>
|
||||
|
||||
{% 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">
|
||||
<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" %}'
|
||||
@@ -16,8 +11,27 @@ 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 %}
|
||||
Reference in New Issue
Block a user