Skip to content

Commit

Permalink
Change spaces to tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
zmilonas committed Sep 27, 2018
1 parent 7eb59f1 commit f902251
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
8 changes: 4 additions & 4 deletions services/unlockedState.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ function UnlockedState($router, keepassReference, protectedMemory, settings, not

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
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;
copyEntry = null;
copyPart = null;
e.clipboardData.setData('text/plain', textToPutOnClipboard);
e.preventDefault();

Expand Down
72 changes: 36 additions & 36 deletions src/components/EntryListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
`
<script>
import { parseUrl } from '$lib/utils.js'
const OTP = require('keeweb/app/scripts/util/otp.js');
const OTP = require('keeweb/app/scripts/util/otp.js');
export default {
props: {
Expand All @@ -56,35 +56,35 @@
},
data() {
return {
// OTP
otp: false,
otp_loop: undefined,
otp_value: "",
// OTP
otp: false,
otp_loop: undefined,
otp_value: "",
keyHandler: e => {
if ((e.ctrlKey || e.metaKey) && e.key == "/" && !e.altKey && !e.shiftKey) {
this.copyOtp(e);
}
if ((e.ctrlKey || e.metaKey) && e.key == "/" && !e.altKey && !e.shiftKey) {
this.copyOtp(e);
}
}
}
}
},
beforeDestroy(){
clearInterval(this.otp_loop)
},
beforeDestroy(){
clearInterval(this.otp_loop)
},
methods: {
details(e) {
this.$router.route("/entry-details/" + this.entry.id)
},
setupOTP(url) {
let totp = OTP.parseUrl(url)
setupOTP(url) {
let totp = OTP.parseUrl(url)
this.otp = typeof totp.key !== "undefined"
let do_otp = () => {
totp.next(code => {
this.otp_value = code;
})
}
this.otp_loop = setInterval(do_otp, 2000)
do_otp()
},
let do_otp = () => {
totp.next(code => {
this.otp_value = code;
})
}
this.otp_loop = setInterval(do_otp, 2000)
do_otp()
},
autofill(e) {
e.stopPropagation()
console.log("autofill")
Expand All @@ -94,24 +94,24 @@
e.stopPropagation()
console.log("copy")
this.unlockedState.copyPassword(this.entry);
},
copyOtp(e) {
e.stopPropagation()
},
copyOtp(e) {
e.stopPropagation()
this.unlockedState.copyTotp(this.otp_value);
},
parseUrl(url) {
url = url.indexOf('http') < 0 ? 'http://' + url : url
let a = document.createElement('a')
a.href = url
return a
}
parseUrl(url) {
url = url.indexOf('http') < 0 ? 'http://' + url : url
let a = document.createElement('a')
a.href = url
return a
}
},
mounted() {
const otpUrl = this.unlockedState.getDecryptedAttribute(this.entry, "otp");
if (otpUrl.length) {
this.setupOTP(otpUrl)
}
window.addEventListener("keydown", this.keyHandler);
const otpUrl = this.unlockedState.getDecryptedAttribute(this.entry, "otp");
if (otpUrl.length) {
this.setupOTP(otpUrl)
}
window.addEventListener("keydown", this.keyHandler);
}
}
</script>
Expand Down

0 comments on commit f902251

Please sign in to comment.