authorize: disable html submit button on click

This commit is contained in:
Philippe Loctaux 2023-04-22 13:24:23 +02:00
parent a32d6b4807
commit fa2d42e5da

View file

@ -24,7 +24,7 @@
<h2 class="h2">Access {{ app_name }}</h2>
<p class="text-muted">With your {{ business_name }} account</p>
</div>
<form action="" method="post" autocomplete="off" novalidate class="mt-4">
<form id="authorize_form" action="" method="post" autocomplete="off" novalidate class="mt-4">
{% if user %}
<div class="mb-4 text-center">
{{ user::avatar(username=user.username, name=user.name, size="xl", css="mb-3") }}
@ -71,5 +71,19 @@
<!-- Tabler Core -->
<script src="/js/tabler.min.js" defer></script>
<script src="/js/demo.min.js" defer></script>
<script>
/**
* @param {string} formId
*/
function disableSubmitButtonForm(formId) {
document.getElementById(formId).addEventListener("submit", (event => {
event.submitter.classList.add("btn-loading");
}));
}
disableSubmitButtonForm("authorize_form");
</script>
</body>
{% endblock page %}