From ab5bec0362c2f293b9a767700191880f175dcdb8 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Tue, 30 May 2023 18:01:22 -0400 Subject: [PATCH 1/2] feat: disable login button on submit --- ietf/templates/registration/login.html | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ietf/templates/registration/login.html b/ietf/templates/registration/login.html index a3ec86a355..f36270dfaf 100644 --- a/ietf/templates/registration/login.html +++ b/ietf/templates/registration/login.html @@ -6,7 +6,7 @@ {% block content %} {% origin %}

Sign in

-
+ {% csrf_token %} {% bootstrap_form form %}
@@ -16,4 +16,21 @@

Sign in

Don't have an account? Create an account.
+{% endblock %} +{% block js %} + {% endblock %} \ No newline at end of file From 8574c1cbc4b5924541cade4d144f0b033a5081b6 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Wed, 31 May 2023 15:10:59 -0400 Subject: [PATCH 2/2] refactor: move login js into its own file --- ietf/static/js/login.js | 14 ++++++++++++++ ietf/templates/registration/login.html | 17 ++--------------- package.json | 1 + 3 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 ietf/static/js/login.js diff --git a/ietf/static/js/login.js b/ietf/static/js/login.js new file mode 100644 index 0000000000..770d091bf1 --- /dev/null +++ b/ietf/static/js/login.js @@ -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) +}) diff --git a/ietf/templates/registration/login.html b/ietf/templates/registration/login.html index f36270dfaf..01949e0f30 100644 --- a/ietf/templates/registration/login.html +++ b/ietf/templates/registration/login.html @@ -1,5 +1,6 @@ {# Copyright The IETF Trust 2015, All Rights Reserved #} {% extends "base.html" %} +{% load static %} {% load origin %} {% load django_bootstrap5 %} {% block title %}Sign in{% endblock %} @@ -18,19 +19,5 @@

Sign in

{% endblock %} {% block js %} - + {% endblock %} \ No newline at end of file diff --git a/package.json b/package.json index e878dd31c0..22365773d2 100644 --- a/package.json +++ b/package.json @@ -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",