Преглед изворни кода

Remove copy-text-to-clipboard and clear clipboard after 30 seconds

pull/612/head
Guillaume Vincent пре 3 година
родитељ
комит
1f216545ad
5 измењених фајлова са 18 додато и 53 уклоњено
  1. +1
    -2
      packages/lesspass-pure/package.json
  2. +15
    -10
      packages/lesspass-pure/src/views/PasswordGenerator.vue
  3. +0
    -5
      packages/lesspass-pure/yarn.lock
  4. +2
    -1
      packages/lesspass-web-extension/extension/manifest.json
  5. +0
    -35
      sandbox/copy-paste-async.html

+ 1
- 2
packages/lesspass-pure/package.json Прегледај датотеку

@@ -1,6 +1,6 @@
{
"name": "lesspass-pure",
"version": "9.4.6",
"version": "9.5.0",
"description": "LessPass web component",
"license": "GPL-3.0",
"author": "Guillaume Vincent <guillaume@oslab.fr>",
@@ -37,7 +37,6 @@
"axios": "^0.21.1",
"balloon-css": "^1.0.3",
"bootstrap": "^4.6.0",
"copy-text-to-clipboard": "^3.0.1",
"core-js": "^3.9.1",
"font-awesome": "^4.7.0",
"jwt-decode": "^3.1.2",


+ 15
- 10
packages/lesspass-pure/src/views/PasswordGenerator.vue Прегледај датотеку

@@ -114,7 +114,6 @@ div.awesomplete > ul {
<script>
import LessPass from "lesspass";
import { mapGetters, mapState } from "vuex";
import copy from "copy-text-to-clipboard";
import RemoveAutoComplete from "../components/RemoveAutoComplete.vue";
import MasterPassword from "../components/MasterPassword.vue";
import InputSite from "../components/InputSite.vue";
@@ -195,6 +194,7 @@ export default {
this.masterPassword = "";
this.passwordGenerated = "";
this.$refs.masterPassword.hide();
navigator.clipboard.writeText("").catch(console.error);
}, thirtySecondsInMillisecond);
},
generatePassword() {
@@ -266,16 +266,21 @@ export default {
}
},
copyPassword() {
const copied = copy(this.passwordGenerated);
if (copied) {
const element = document.getElementById("copyPasswordButton");
showTooltip(element, this.$t("Copied", "copied !"));
setTimeout(() => hideTooltip(element), 2000);
} else {
message.warning(
this.$t("SorryCopy", "Sorry, copying only works in modern browsers.")
navigator.clipboard
.writeText(this.passwordGenerated)
.then(() => {
const element = document.getElementById("copyPasswordButton");
showTooltip(element, this.$t("Copied", "copied !"));
setTimeout(() => hideTooltip(element), 2000);
})
.catch(() =>
message.warning(
this.$t(
"SorryCopy",
"Sorry, copying only works in modern browsers."
)
)
);
}
},
sharePasswordProfile() {
const copied = copy(this.passwordURL);


+ 0
- 5
packages/lesspass-pure/yarn.lock Прегледај датотеку

@@ -3740,11 +3740,6 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=

copy-text-to-clipboard@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.0.1.tgz#8cbf8f90e0a47f12e4a24743736265d157bce69c"
integrity sha512-rvVsHrpFcL4F2P8ihsoLdFHmd404+CMg71S756oRSeQgqk51U3kicGdnvfkrxva0xXH92SjGS62B0XIJsbh+9Q==

copy-webpack-plugin@^5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-5.1.2.tgz#8a889e1dcafa6c91c6cd4be1ad158f1d3823bae2"


+ 2
- 1
packages/lesspass-web-extension/extension/manifest.json Прегледај датотеку

@@ -16,7 +16,8 @@
}
},
"permissions": [
"activeTab"
"activeTab",
"clipboardWrite"
],
"browser_action": {
"browser_style": false,


+ 0
- 35
sandbox/copy-paste-async.html Прегледај датотеку

@@ -1,35 +0,0 @@
<button id="copyButton" onclick="Run()">Generate</button>
<script>
function GetButton() {
return document.getElementById("copyButton");
}
function UpdateButtonText(text) {
GetButton().innerText = text;
}
function DisableButton() {
GetButton().disabled = true;
}
function GeneratePassword() {
UpdateButtonText("Generating");
setTimeout(() => UpdateButtonText("Generating."), 1000);
setTimeout(() => UpdateButtonText("Generating.."), 2000);
setTimeout(() => UpdateButtonText("Generating..."), 3000);
return new Promise(resolve => {
setTimeout(resolve, 4000, 'm<=u6T8`hM"nxwuY');
});
}
function CopyToClipboard(password) {
return navigator.clipboard.writeText(password).then(() => {
UpdateButtonText("Copied in clipboard!");
DisableButton();
});
}
function Run() {
GeneratePassword().then(password => {
CopyToClipboard(password).catch(error => {
UpdateButtonText("Click to copy!");
GetButton().onclick = () => CopyToClipboard(password);
});
});
}
</script>

Loading…
Откажи
Сачувај