1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 13:35:23 +02:00

security: enforce min length for user password (#1555)

* fix typing on auth context

* extract user password strength meter

* fix broken useToggle method

* extend form to accept arguments for validators

* enforce password length on update

* fix user password change form
This commit is contained in:
Hayden 2022-08-13 21:38:26 -08:00 committed by GitHub
parent b3c41a4bd0
commit 54c4f19a5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 105 additions and 95 deletions

View file

@ -187,9 +187,16 @@ export default defineComponent({
const list = [] as ((v: string) => boolean | string)[];
keys.forEach((key) => {
if (key in validators) {
// @ts-ignore TODO: fix this
list.push(validators[key]);
const split = key.split(":");
const validatorKey = split[0] as ValidatorKey;
if (validatorKey in validators) {
if (split.length === 1) {
// @ts-ignore- validators[validatorKey] is a function
list.push(validators[validatorKey]);
} else {
// @ts-ignore - validators[validatorKey] is a function
list.push(validators[validatorKey](split[1]));
}
}
});
return list;

View file

@ -6,8 +6,7 @@
</template>
<script lang="ts">
import { defineComponent, watch } from "@nuxtjs/composition-api";
import { useToggle } from "@vueuse/core";
import { defineComponent, ref, watch } from "@nuxtjs/composition-api";
export default defineComponent({
props: {
@ -21,7 +20,11 @@ export default defineComponent({
},
},
setup(_, context) {
const [state, toggle] = useToggle();
const state = ref(false);
const toggle = () => {
state.value = !state.value;
};
watch(state, () => {
context.emit("input", state);