Module now exports functions that check if a password is strong enough and equal to a potential confirmation field

ref #106
This commit is contained in:
2021-03-26 19:45:53 +01:00
parent 7862f44653
commit b2509e9e53
2 changed files with 23 additions and 16 deletions

View File

@@ -4,7 +4,7 @@
import { MeService } from "@odit/lfk-client-js";
import Toastify from "toastify-js";
import ConfirmProfileDeletion from "./ConfirmProfileDeletion.svelte";
import PasswordStrength from "../auth/PasswordStrength.svelte";
import PasswordStrength, {password_strong_enough_and_equal} from "../auth/PasswordStrength.svelte";
$: data_loaded = false;
$: delete_triggered = false;
$: original_data = {};
@@ -16,8 +16,7 @@
JSON.stringify(editable) === JSON.stringify(original_data)
);
$: save_enabled = changes_performed && isEmail(editable.email);
$: update_password_enabled =
password_change.length > 0 && password_change === password_confirm;
$: update_password_enabled = password_strong_enough_and_equal(password_change, password_confirm);
const user_promise = MeService.meControllerGet().then((data) => {
data_loaded = true;
data.groups = data.groups.map((g) => g.id);