From 6279dc7dd0a834976a6557a189fc3441ad1d5510 Mon Sep 17 00:00:00 2001 From: Gabriel De Los Rios Date: Mon, 25 Nov 2024 23:46:39 -0300 Subject: [PATCH] refactor: js password validation to single file --- app/static/js/passwords-match.js | 8 ++++++++ app/templates/users/register.html | 11 +---------- 2 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 app/static/js/passwords-match.js diff --git a/app/static/js/passwords-match.js b/app/static/js/passwords-match.js new file mode 100644 index 0000000..26c41fd --- /dev/null +++ b/app/static/js/passwords-match.js @@ -0,0 +1,8 @@ +(() => { + 'use strict' + const password = document.getElementById("password"); + const password_validation = document.getElementById("password-confirmation"); + password.addEventListener('change', (c) => { + password_validation.setAttribute("pattern", c.target.value); + }); +})() \ No newline at end of file diff --git a/app/templates/users/register.html b/app/templates/users/register.html index eb9695f..6399e47 100644 --- a/app/templates/users/register.html +++ b/app/templates/users/register.html @@ -97,14 +97,5 @@ - + {% endblock %} \ No newline at end of file