Skip to content

Commit

Permalink
feat: disable login button on submit (#5718)
Browse files Browse the repository at this point in the history
* feat: disable login button on submit

* refactor: move login js into its own file
  • Loading branch information
NGPixel authored May 31, 2023
1 parent f399d0e commit 1ec403d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
14 changes: 14 additions & 0 deletions ietf/static/js/login.js
Original file line number Diff line number Diff line change
@@ -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)
})
6 changes: 5 additions & 1 deletion ietf/templates/registration/login.html
Original file line number Diff line number Diff line change
@@ -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">
Expand All @@ -16,4 +17,7 @@ <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 src="{% static 'ietf/js/login.js' %}"></script>
{% endblock %}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1ec403d

Please sign in to comment.