From 3a872f78d00aad53444c3f8f22d5ffc21ac68874 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 18 Jan 2026 13:58:44 +0000
Subject: [PATCH] Extract password strength meter into reusable component with
SCSS color variables
Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
---
extra/reset-password.js | 2 +-
src/components/PasswordStrengthMeter.vue | 95 ++++++++++++++++++++++++
src/components/settings/Security.vue | 70 ++---------------
src/pages/Setup.vue | 68 ++---------------
4 files changed, 108 insertions(+), 127 deletions(-)
create mode 100644 src/components/PasswordStrengthMeter.vue
diff --git a/extra/reset-password.js b/extra/reset-password.js
index 8c495a299..278d523d9 100644
--- a/extra/reset-password.js
+++ b/extra/reset-password.js
@@ -52,7 +52,7 @@ const main = async () => {
}
if (passwordValidation.warning) {
console.warn("\x1b[31m%s\x1b[0m",
- "Warning: "+passwordValidation.warning);
+ "Warning: " + passwordValidation.warning);
}
} else {
password = await question("New Password: ");
diff --git a/src/components/PasswordStrengthMeter.vue b/src/components/PasswordStrengthMeter.vue
new file mode 100644
index 000000000..04ec766c7
--- /dev/null
+++ b/src/components/PasswordStrengthMeter.vue
@@ -0,0 +1,95 @@
+
+
+
+
+ {{ $t("passwordWeakWarning") }}
+
+
+
+
+
+
+
diff --git a/src/components/settings/Security.vue b/src/components/settings/Security.vue
index 6e3c6e8b6..9b616debc 100644
--- a/src/components/settings/Security.vue
+++ b/src/components/settings/Security.vue
@@ -45,18 +45,11 @@
/>
-
-
-
- {{ $t("passwordWeakWarning") }}
-
-
+
@@ -161,12 +154,14 @@
-
diff --git a/src/pages/Setup.vue b/src/pages/Setup.vue
index 6803770a6..d849c029c 100644
--- a/src/pages/Setup.vue
+++ b/src/pages/Setup.vue
@@ -48,18 +48,7 @@
-
-
-
- {{ $t("passwordWeakWarning") }}
-
-
+
import zxcvbn from "zxcvbn";
+import PasswordStrengthMeter from "../components/PasswordStrengthMeter.vue";
export default {
+ components: {
+ PasswordStrengthMeter,
+ },
data() {
return {
processing: false,
@@ -100,21 +93,6 @@ export default {
passwordStrength: null,
};
},
- computed: {
- strengthClass() {
- if (this.passwordStrength === null) {
- return "";
- }
- const classes = [ "strength-very-weak", "strength-weak", "strength-fair", "strength-good", "strength-strong" ];
- return classes[this.passwordStrength] || "";
- },
- strengthWidth() {
- if (this.passwordStrength === null) {
- return "0%";
- }
- return `${(this.passwordStrength + 1) * 20}%`;
- },
- },
watch: {},
mounted() {
// TODO: Check if it is a database setup
@@ -210,40 +188,4 @@ export default {
margin: auto;
text-align: center;
}
-
-.password-strength {
- margin-top: 0.5rem;
-}
-
-.strength-meter {
- height: 5px;
- background-color: #e0e0e0;
- border-radius: 3px;
- overflow: hidden;
-}
-
-.strength-meter-fill {
- height: 100%;
- transition: width 0.3s ease, background-color 0.3s ease;
-}
-
-.strength-very-weak {
- background-color: #dc3545;
-}
-
-.strength-weak {
- background-color: #fd7e14;
-}
-
-.strength-fair {
- background-color: #ffc107;
-}
-
-.strength-good {
- background-color: #20c997;
-}
-
-.strength-strong {
- background-color: #28a745;
-}