瀏覽代碼

Use csv stringify instead of to handle special char in passwords

tags/pure-v10.0.1
Guillaume Vincent 1 年之前
父節點
當前提交
fd18d21535
共有 3 個文件被更改,包括 15 次插入4 次删除
  1. +1
    -0
      packages/lesspass-pure/package.json
  2. +9
    -4
      packages/lesspass-pure/src/views/ExportYourPasswords.vue
  3. +5
    -0
      yarn.lock

+ 1
- 0
packages/lesspass-pure/package.json 查看文件

@@ -57,6 +57,7 @@
"balloon-css": "^1.0.3",
"bootstrap": "^4.6.0",
"core-js": "^3.9.1",
"csv-stringify": "^6.2.3",
"file-saver": "^2.0.5",
"font-awesome": "^4.7.0",
"jwt-decode": "^3.1.2",


+ 9
- 4
packages/lesspass-pure/src/views/ExportYourPasswords.vue 查看文件

@@ -29,6 +29,7 @@
</template>
<script>
import LessPass from "lesspass";
import { stringify } from "csv-stringify/lib/sync";
import MasterPassword from "../components/MasterPassword.vue";
import message from "../services/message";
import { mapState } from "vuex";
@@ -59,18 +60,22 @@ export default {
},
exportPasswords: async function () {
if (this.formIsValid()) {
let content = "name,url,username,password\n";
let lines = [["name", "url", "username", "password"]];
for (let i = 0; i < this.passwords.length; i++) {
const passwordProfile = this.passwords[i];
passwordProfile["digits"] = passwordProfile["numbers"];
console.log(JSON.stringify(passwordProfile, null, 2));
console.log(this.masterPassword);
const generatedPassword = await LessPass.generatePassword(
passwordProfile,
this.masterPassword
);
content += `${passwordProfile.site},https://${passwordProfile.site},${passwordProfile.login},${generatedPassword}\n`;
lines.push([
passwordProfile.site,
`https://${passwordProfile.site}`,
passwordProfile.login,
generatedPassword,
]);
}
const content = stringify(lines);
var blob = new Blob([content], { type: "text/csv;charset=utf-8" });
saveAs(blob, "LessPass passwords.csv");
message.success("Your passwords has been exported successfully.");


+ 5
- 0
yarn.lock 查看文件

@@ -5276,6 +5276,11 @@ cssstyle@^2.0.0, cssstyle@^2.3.0:
dependencies:
cssom "~0.3.6"

csv-stringify@^6.2.3:
version "6.2.3"
resolved "https://registry.yarnpkg.com/csv-stringify/-/csv-stringify-6.2.3.tgz#fefd25e66fd48f8f42f43b85a66a4663a2c3e796"
integrity sha512-4qGjUMwnlaRc00gc2jrIYh2w/h1fo25B0mTuY9K8fBiIgtmCX3LcgUbrEGViL98Ci4Se/F5LFEtu8k+dItJVZQ==

currently-unhandled@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea"


Loading…
取消
儲存