Skip to content

Commit

Permalink
feat: disable login button on submit
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed May 30, 2023
1 parent f8e1899 commit ab5bec0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion ietf/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% block content %}
{% origin %}
<h1>Sign in</h1>
<form method="post">
<form method="post" id="dt-login-form">
{% csrf_token %}
{% bootstrap_form form %}
<div class="mt-4 mb-3">
Expand All @@ -16,4 +16,21 @@ <h1>Sign in</h1>
</div>
Don't have an account? <a href="{% url 'ietf.ietfauth.views.create_account' %}">Create an account</a>.
</form>
{% endblock %}
{% block js %}
<script>
/**
* Disable Submit Button on Form Submit
*/
function onLoginSubmit (ev) {
const submitBtn = document.querySelector('#dt-login-form button[type=submit]')
if (submitBtn) {
submitBtn.disabled = true
submitBtn.innerHTML = 'Signing in...'
}
}
$(document).ready(function () {
document.querySelector('#dt-login-form').addEventListener('submit', onLoginSubmit)
})
</script>
{% endblock %}

0 comments on commit ab5bec0

Please sign in to comment.