From 3a6092ce4f5dde206f4123aea6352b36588dd4e2 Mon Sep 17 00:00:00 2001 From: Philippe Loctaux Date: Sat, 22 Apr 2023 13:51:31 +0200 Subject: [PATCH] authorize: delay form submission by 800ms --- crates/ezidam/templates/pages/oauth/authorize.html.tera | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ezidam/templates/pages/oauth/authorize.html.tera b/crates/ezidam/templates/pages/oauth/authorize.html.tera index 3740bed..f9ac1df 100644 --- a/crates/ezidam/templates/pages/oauth/authorize.html.tera +++ b/crates/ezidam/templates/pages/oauth/authorize.html.tera @@ -77,8 +77,12 @@ * @param {string} formId */ function disableSubmitButtonForm(formId) { - document.getElementById(formId).addEventListener("submit", (event => { + const form = document.getElementById(formId); + + form.addEventListener("submit", (event => { + event.preventDefault(); event.submitter.classList.add("btn-loading"); + setTimeout(() => form.submit(), 800) })); }