From a85e9734afed6cc7d6aa76b1d6a89b5cf099589e Mon Sep 17 00:00:00 2001 From: gourav Date: Thu, 13 Jun 2024 22:32:47 +0530 Subject: [PATCH] totp generation is working moved create secret to modal --- frontend/package-lock.json | 17 ++++++++++++++++ frontend/package.json | 1 + frontend/src/App.vue | 16 +++++++++------ frontend/src/components/CreateSecret.vue | 26 +++++++++++++++++++----- frontend/src/components/ListSecrets.vue | 16 ++++++++++++++- 5 files changed, 64 insertions(+), 12 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 9f0ec85..ac07f8e 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0", "dependencies": { "element-plus": "^2.7.5", + "totp-generator": "^1.0.0", "vue": "^3.4.21" }, "devDependencies": { @@ -1830,6 +1831,14 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "node_modules/jssha": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jssha/-/jssha-3.3.1.tgz", + "integrity": "sha512-VCMZj12FCFMQYcFLPRm/0lOBbLi8uM2BhXPTqw3U4YAfs4AZfiApOoBLoN8cQE60Z50m1MYMTQVCfgF/KaCVhQ==", + "engines": { + "node": "*" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -2361,6 +2370,14 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, + "node_modules/totp-generator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/totp-generator/-/totp-generator-1.0.0.tgz", + "integrity": "sha512-Iu/1Lk60/MH8FE+5cDWPiGbwKK1hxzSq+KT9oSqhZ1BEczGIKGcN50bP0WMLiIZKRg7t29iWLxw6f81TICQdoA==", + "dependencies": { + "jssha": "^3.3.1" + } + }, "node_modules/tslib": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", diff --git a/frontend/package.json b/frontend/package.json index 4e4b4d7..fb1e4d9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "element-plus": "^2.7.5", + "totp-generator": "^1.0.0", "vue": "^3.4.21" }, "devDependencies": { diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 03d28d0..c199ca1 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -23,12 +23,8 @@ import ListSecrets from "./components/ListSecrets.vue"; - - +
@@ -37,7 +33,7 @@ import ListSecrets from "./components/ListSecrets.vue"; Hide secrets - +
@@ -49,6 +45,7 @@ export default { loggedin: false, showSecrets: false, creationDialog: false, + listUpdated: 1, }; }, methods: { @@ -56,6 +53,13 @@ export default { localStorage.removeItem("token"); this.loggedin = false; }, + + secretSaved() { + this.creationDialog = false; + console.log("before update", this.listUpdated); + this.listUpdated += 1; + console.log("after update", this.listUpdated); + }, }, }; diff --git a/frontend/src/components/CreateSecret.vue b/frontend/src/components/CreateSecret.vue index 96e050b..fce905e 100644 --- a/frontend/src/components/CreateSecret.vue +++ b/frontend/src/components/CreateSecret.vue @@ -18,7 +18,15 @@ - Create secret + Save & Add More + Save & Close @@ -30,10 +38,10 @@ export default { title: "Create Secret", apiBaseUrl: "http://localhost:8000", form: { - issuer: "asdfasdf", - username: "asdfasdf", - secret: "asdfasdf", - notes: "asdfasdf", + issuer: "", + username: "", + secret: "", + notes: "", }, }; }, @@ -55,6 +63,14 @@ export default { .then((response) => response.json()) .then((data) => console.log(data)); }, + + closeDialog() { + (this.form.issuer = ""), + (this.form.username = ""), + (this.form.notes = ""), + (this.form.secret = ""); + this.$emit("close", true); + }, }, }; diff --git a/frontend/src/components/ListSecrets.vue b/frontend/src/components/ListSecrets.vue index 91eeb39..6703813 100644 --- a/frontend/src/components/ListSecrets.vue +++ b/frontend/src/components/ListSecrets.vue @@ -3,13 +3,21 @@ - + + +