From b07da75c68b4a2acdbdf140edd71fe33b8ef6cdf Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 21 Apr 2021 16:37:52 +0200 Subject: [PATCH] Prevent the hash appearing when showing the password Signed-off-by: Joas Schilling --- js/registration-form.js | 4 ++-- js/registration-form.js.map | 2 +- src/form.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/registration-form.js b/js/registration-form.js index 074b206c..5e87ac80 100644 --- a/js/registration-form.js +++ b/js/registration-form.js @@ -1,2 +1,2 @@ -!function(){"use strict";document.addEventListener("DOMContentLoaded",(function(){var i=this;$("#showadminpass").click((function(){var t=$("#password");"password"===t.attr("type")?t.attr("type","text"):t.attr("type","password")})),$("form").submit((function(){$(i).find(":submit").attr("disabled","disabled"),$(i).find(":submit")[0].value=t("registration","Loading …")}))}))}(); -//# sourceMappingURL=registration-form.js.map?v=9934ad4775c110e9376d \ No newline at end of file +!function(){"use strict";document.addEventListener("DOMContentLoaded",(function(){var a=this;$("#showadminpass").click((function(t){t.preventDefault();var a=$("#password");"password"===a.attr("type")?a.attr("type","text"):a.attr("type","password")})),$("form").submit((function(){$(a).find(":submit").attr("disabled","disabled"),$(a).find(":submit")[0].value=t("registration","Loading …")}))}))}(); +//# sourceMappingURL=registration-form.js.map?v=2f99bd8b8e2f96df0fe1 \ No newline at end of file diff --git a/js/registration-form.js.map b/js/registration-form.js.map index 5d69ca58..4cb34965 100644 --- a/js/registration-form.js.map +++ b/js/registration-form.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://registration/./src/form.js"],"names":["document","addEventListener","$","click","passwordTextField","attr","submit","find","value","t"],"mappings":"yBAAAA,SAASC,iBAAiB,oBAAoB,WAAW,WAExDC,EAAE,kBAAkBC,OAAM,WACzB,IAAMC,EAAoBF,EAAE,aACW,aAAnCE,EAAkBC,KAAK,QAC1BD,EAAkBC,KAAK,OAAQ,QAE/BD,EAAkBC,KAAK,OAAQ,eAKjCH,EAAE,QAAQI,QAAO,WAEhBJ,EAAE,GAAMK,KAAK,WAAWF,KAAK,WAAY,YACzCH,EAAE,GAAMK,KAAK,WAAW,GAAGC,MAAQC,EAAE,eAAgB,mB","file":"registration-form.js?v=9934ad4775c110e9376d","sourcesContent":["document.addEventListener('DOMContentLoaded', function() {\n\t// Password toggle\n\t$('#showadminpass').click(() => {\n\t\tconst passwordTextField = $('#password')\n\t\tif (passwordTextField.attr('type') === 'password') {\n\t\t\tpasswordTextField.attr('type', 'text')\n\t\t} else {\n\t\t\tpasswordTextField.attr('type', 'password')\n\t\t}\n\t})\n\n\t// Disable submit after first click\n\t$('form').submit(() => {\n\t\t// prevent duplicate form submissions\n\t\t$(this).find(':submit').attr('disabled', 'disabled')\n\t\t$(this).find(':submit')[0].value = t('registration', 'Loading …')\n\t})\n})\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://registration/./src/form.js"],"names":["document","addEventListener","$","click","e","preventDefault","passwordTextField","attr","submit","find","value","t"],"mappings":"yBAAAA,SAASC,iBAAiB,oBAAoB,WAAW,WAExDC,EAAE,kBAAkBC,OAAM,SAACC,GAC1BA,EAAEC,iBACF,IAAMC,EAAoBJ,EAAE,aACW,aAAnCI,EAAkBC,KAAK,QAC1BD,EAAkBC,KAAK,OAAQ,QAE/BD,EAAkBC,KAAK,OAAQ,eAKjCL,EAAE,QAAQM,QAAO,WAEhBN,EAAE,GAAMO,KAAK,WAAWF,KAAK,WAAY,YACzCL,EAAE,GAAMO,KAAK,WAAW,GAAGC,MAAQC,EAAE,eAAgB,mB","file":"registration-form.js?v=2f99bd8b8e2f96df0fe1","sourcesContent":["document.addEventListener('DOMContentLoaded', function() {\n\t// Password toggle\n\t$('#showadminpass').click((e) => {\n\t\te.preventDefault()\n\t\tconst passwordTextField = $('#password')\n\t\tif (passwordTextField.attr('type') === 'password') {\n\t\t\tpasswordTextField.attr('type', 'text')\n\t\t} else {\n\t\t\tpasswordTextField.attr('type', 'password')\n\t\t}\n\t})\n\n\t// Disable submit after first click\n\t$('form').submit(() => {\n\t\t// prevent duplicate form submissions\n\t\t$(this).find(':submit').attr('disabled', 'disabled')\n\t\t$(this).find(':submit')[0].value = t('registration', 'Loading …')\n\t})\n})\n"],"sourceRoot":""} \ No newline at end of file diff --git a/src/form.js b/src/form.js index df9c8847..e46db8d4 100644 --- a/src/form.js +++ b/src/form.js @@ -1,6 +1,7 @@ document.addEventListener('DOMContentLoaded', function() { // Password toggle - $('#showadminpass').click(() => { + $('#showadminpass').click((e) => { + e.preventDefault() const passwordTextField = $('#password') if (passwordTextField.attr('type') === 'password') { passwordTextField.attr('type', 'text')