feat: disable login button on submit (#5718)

* feat: disable login button on submit

* refactor: move login js into its own file
This commit is contained in:
Nicolas Giard 2023-05-31 15:58:09 -04:00 committed by GitHub
parent f399d0efd5
commit 1ec403dc8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

14
ietf/static/js/login.js Normal file
View file

@ -0,0 +1,14 @@
/**
* 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...'
}
}
$(function() {
document.querySelector('#dt-login-form').addEventListener('submit', onLoginSubmit)
})

View file

@ -1,12 +1,13 @@
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% extends "base.html" %}
{% load static %}
{% load origin %}
{% load django_bootstrap5 %}
{% block title %}Sign in{% endblock %}
{% 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">
@ -16,4 +17,7 @@
</div>
Don't have an account? <a href="{% url 'ietf.ietfauth.views.create_account' %}">Create an account</a>.
</form>
{% endblock %}
{% block js %}
<script src="{% static 'ietf/js/login.js' %}"></script>
{% endblock %}

View file

@ -133,6 +133,7 @@
"ietf/static/js/js-cookie.js",
"ietf/static/js/liaisons.js",
"ietf/static/js/list.js",
"ietf/static/js/login.js",
"ietf/static/js/manage-community-list.js",
"ietf/static/js/manage-review-requests.js",
"ietf/static/js/meeting-interim-request.js",