prevent password save prompt on key field

This commit is contained in:
Evert Prants 2021-02-14 10:07:10 +02:00
parent ffaf00a130
commit 568c92cbf9
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 12 additions and 2 deletions

View File

@ -74,15 +74,25 @@ function dashboard () {
$('#keybox').val('A'.repeat(36)) $('#keybox').val('A'.repeat(36))
$('#keybox').on('click', function (e) { $('#keybox').on('click', function (e) {
$(this)[0].select() $(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) { $('#show_key').on('click', function (e) {
if (shown) { if (shown) {
$('#keybox').val('A'.repeat(36)) $('#keybox').val('A'.repeat(36))
$('#keybox').attr('type', 'password') $('#keybox').attr('type', 'password')
$('#keybox').attr('readonly', true)
$(this).text('Reveal Key') $(this).text('Reveal Key')
} else { } else {
$('#keybox').removeAttr('readonly')
$('#keybox').val(key) $('#keybox').val(key)
$('#keybox').attr('type', 'text') $('#keybox').attr('type', 'text')
$(this).text('Hide Key') $(this).text('Hide Key')

View File

@ -88,7 +88,7 @@
<label>Stream Key</label> <label>Stream Key</label>
</div> </div>
<div class="col"> <div class="col">
<input type="password" id="keybox"> <input type="password" id="keybox" autocomplete="off" readonly>
<button href="#" id="show_key" class="btn btn-primary">Reveal Key</button> <button href="#" id="show_key" class="btn btn-primary">Reveal Key</button>
<button href="#" id="copy_key" class="btn btn-success">Copy</button> <button href="#" id="copy_key" class="btn btn-success">Copy</button>
</div> </div>