From 568c92cbf9404ac13762f5f4f6484343be174497 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Sun, 14 Feb 2021 10:07:10 +0200 Subject: [PATCH] prevent password save prompt on key field --- src/dashboard.js | 12 +++++++++++- templates/dashboard.html | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/dashboard.js b/src/dashboard.js index f42b61e..f6c4c9f 100644 --- a/src/dashboard.js +++ b/src/dashboard.js @@ -74,15 +74,25 @@ function dashboard () { $('#keybox').val('A'.repeat(36)) $('#keybox').on('click', function (e) { $(this)[0].select() - $(this)[0].setSelectionRange(0, key.length) + $(this)[0].setSelectionRange(0, $(this).val().length) + }) + + $('#keybox').on('change', function (e) { + if (!shown) { + $('#keybox').val('A'.repeat(36)) + } else { + $('#keybox').val(key) + } }) $('#show_key').on('click', function (e) { if (shown) { $('#keybox').val('A'.repeat(36)) $('#keybox').attr('type', 'password') + $('#keybox').attr('readonly', true) $(this).text('Reveal Key') } else { + $('#keybox').removeAttr('readonly') $('#keybox').val(key) $('#keybox').attr('type', 'text') $(this).text('Hide Key') diff --git a/templates/dashboard.html b/templates/dashboard.html index e719fd7..065434c 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -88,7 +88,7 @@
- +