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 @@
- +