diff --git a/services/unlockedState.js b/services/unlockedState.js index 86a47643..b1ac8320 100644 --- a/services/unlockedState.js +++ b/services/unlockedState.js @@ -150,10 +150,16 @@ function UnlockedState($router, keepassReference, protectedMemory, settings, not return; //listener can get registered multiple times } - var textToPutOnClipboard = getAttribute(copyEntry, copyPart); - var fieldName = copyPart.charAt(0).toUpperCase() + copyPart.slice(1); // https://stackoverflow.com/a/1026087 - copyEntry = null; - copyPart = null; + let fieldName, textToPutOnClipboard; + if (copyPart === 'userName' || copyPart === 'password') { + textToPutOnClipboard = getAttribute(copyEntry, copyPart); + fieldName = copyPart.charAt(0).toUpperCase() + copyPart.slice(1); // https://stackoverflow.com/a/1026087 + } else { + fieldName = copyPart; + textToPutOnClipboard = copyEntry; + } + copyEntry = null; + copyPart = null; e.clipboardData.setData('text/plain', textToPutOnClipboard); e.preventDefault(); diff --git a/src/components/EntryListItem.vue b/src/components/EntryListItem.vue index 85d4d097..60866b66 100644 --- a/src/components/EntryListItem.vue +++ b/src/components/EntryListItem.vue @@ -62,10 +62,7 @@ otp_value: "", keyHandler: e => { if ((e.ctrlKey || e.metaKey) && e.key == "/" && !e.altKey && !e.shiftKey) { - copyPlain = this.otp_value; - document.execCommand('copy') - copyPlain = undefined; - e.stopPropagation + this.copyOtp(e); } } } @@ -100,6 +97,7 @@ }, copyOtp(e) { e.stopPropagation() + this.unlockedState.copyTotp(this.otp_value); }, parseUrl(url) { url = url.indexOf('http') < 0 ? 'http://' + url : url