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 @@ + + + + + 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; -}