From ee52363bded8510b6ca4ed6ac45bb60458805486 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Mon, 5 May 2025 17:44:03 +0200 Subject: [PATCH] enable switch to pw totp in account settings --- src/components/account/ChangeToPassword.vue | 93 +++++++++++++++++ src/components/account/ChangeToTOTP.vue | 92 +++++++++++++++++ src/components/account/PasswordChange.vue | 96 ++++++++++++++++++ src/components/account/TotpCheckAndScan.vue | 83 ++++++++++++++++ src/views/Login.vue | 16 +++ src/views/account/LoginData.vue | 105 +++++++++----------- 6 files changed, 429 insertions(+), 56 deletions(-) create mode 100644 src/components/account/ChangeToPassword.vue create mode 100644 src/components/account/ChangeToTOTP.vue create mode 100644 src/components/account/PasswordChange.vue create mode 100644 src/components/account/TotpCheckAndScan.vue diff --git a/src/components/account/ChangeToPassword.vue b/src/components/account/ChangeToPassword.vue new file mode 100644 index 0000000..7a2f6a2 --- /dev/null +++ b/src/components/account/ChangeToPassword.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/components/account/ChangeToTOTP.vue b/src/components/account/ChangeToTOTP.vue new file mode 100644 index 0000000..c04197c --- /dev/null +++ b/src/components/account/ChangeToTOTP.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/src/components/account/PasswordChange.vue b/src/components/account/PasswordChange.vue new file mode 100644 index 0000000..f93614b --- /dev/null +++ b/src/components/account/PasswordChange.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/src/components/account/TotpCheckAndScan.vue b/src/components/account/TotpCheckAndScan.vue new file mode 100644 index 0000000..a9ba5ef --- /dev/null +++ b/src/components/account/TotpCheckAndScan.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/src/views/Login.vue b/src/views/Login.vue index 8b5ce8c..908a2c7 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -102,6 +102,22 @@ export default defineComponent({ resetAllPiniaStores(); this.username = localStorage.getItem("username") ?? ""; this.routine = localStorage.getItem("routine") ?? ""; + + if (this.username != "") { + this.$http + .post(`/auth/kickof`, { + username: this.username, + }) + .then((result) => { + this.usernameStatus = "success"; + this.routine = result.data.routine; + localStorage.setItem("routine", result.data.routine); + }) + .catch((err) => { + this.usernameStatus = "failed"; + this.loginError = err.response?.data; + }); + } }, methods: { resetRoutine() { diff --git a/src/views/account/LoginData.vue b/src/views/account/LoginData.vue index 7ba75bb..f91ad25 100644 --- a/src/views/account/LoginData.vue +++ b/src/views/account/LoginData.vue @@ -6,29 +6,41 @@ @@ -42,53 +54,34 @@ import Spinner from "@/components/Spinner.vue"; import SuccessCheckmark from "@/components/SuccessCheckmark.vue"; import FailureXMark from "@/components/FailureXMark.vue"; import TextCopy from "@/components/TextCopy.vue"; +import TotpCheckAndScan from "../../components/account/TotpCheckAndScan.vue"; +import PasswordChange from "../../components/account/PasswordChange.vue"; +import ChangeToPassword from "../../components/account/ChangeToPassword.vue"; +import ChangeToTOTP from "../../components/account/ChangeToTOTP.vue";