tidy up some cimar stuff
This commit is contained in:
@@ -13,8 +13,17 @@ window.control_pressed = false;
|
|||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
document.body.addEventListener("htmx:responseError", function(e) {
|
document.body.addEventListener("htmx:responseError", function(e) {
|
||||||
let error = e.detail.xhr.response;
|
|
||||||
let el = document.getElementById("htmx-error");
|
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.innerHTML = error;
|
||||||
el.classList.remove("hidden");
|
el.classList.remove("hidden");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
{% if case.cimar_uuid %}
|
{% if case.cimar_uuid %}
|
||||||
|
|
||||||
<details><summary>Details</summary>
|
<details><summary>Details</summary>
|
||||||
<br/>
|
|
||||||
Case uuid: {{case.cimar_uuid}}
|
Case uuid: {{case.cimar_uuid}}
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|||||||
@@ -161,6 +161,13 @@
|
|||||||
<div class="row clear-both">
|
<div class="row clear-both">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div id="htmx-error"></div>
|
<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 %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
{% load partials %}
|
||||||
|
|
||||||
{% block content %}
|
{% partialdef login-block %}
|
||||||
<div class="anatomy">
|
|
||||||
|
|
||||||
|
|
||||||
<h2>CIMAR login</h2>
|
|
||||||
Login status: {{ login_status }} ({{cimar_sid}})<br/>
|
|
||||||
|
|
||||||
Logging in here allows your account to be linked with CIMAR. You may periodically need to re-login to keep the link active.
|
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/>
|
Username: <input type="text" id="username" name="username" value=""/> <br/>
|
||||||
Password: <input type="password" id="password" name="password" value=""/> <br/>
|
Password: <input type="password" id="password" name="password" value=""/> <br/>
|
||||||
<button hx-post='{% url "cimar_login" %}'
|
<button hx-post='{% url "cimar_login" %}'
|
||||||
@@ -17,7 +12,26 @@ hx-target="#results">Login</button>
|
|||||||
|
|
||||||
<div id="results"></div>
|
<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>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user