From b18c68449e8abaa7bea3f7bb620b7334b5017bd0 Mon Sep 17 00:00:00 2001
From: Andreas Nedbal <git@pixelde.su>
Date: Thu, 6 Jan 2022 02:55:12 +0100
Subject: [PATCH] Port password confirmation functionality to TypeScript

---
 .../retrospring/features/settings/password.ts      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 app/javascript/retrospring/features/settings/password.ts

diff --git a/app/javascript/retrospring/features/settings/password.ts b/app/javascript/retrospring/features/settings/password.ts
new file mode 100644
index 00000000..86be08c3
--- /dev/null
+++ b/app/javascript/retrospring/features/settings/password.ts
@@ -0,0 +1,14 @@
+/*
+# see GitHub issue #11
+($ document).on "submit", "form#edit_user", (evt) ->
+  if ($ "input#user_current_password").val().length == 0
+    evt.preventDefault()
+    $("button[data-target=#modal-passwd]").trigger 'click'
+*/
+
+export function userSubmitHandler(event: Event): void {
+  if (document.querySelector<HTMLInputElement>('#user_current_password').value.length === 0) {
+    event.preventDefault();
+    document.querySelector<HTMLButtonElement>('[data-target=#modal-passwd]').click();
+  }
+}
\ No newline at end of file