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:
@@ -1,18 +1,26 @@
|
||||
<script>
|
||||
import { getLocaleFromNavigator, _ } from "svelte-i18n";
|
||||
import { passwordStrength } from "check-password-strength";
|
||||
export let password_change;
|
||||
export let password_confirm;
|
||||
|
||||
$: strength = passwordStrength(password_change);
|
||||
$: passwords_match =
|
||||
!password_confirm || password_confirm === password_change;
|
||||
$: update_password_enabled =
|
||||
strength?.contains.includes("lowercase") &&
|
||||
<script context="module">
|
||||
import { passwordStrength } from "check-password-strength";
|
||||
export function password_strong_enough(password_change) {
|
||||
let strength = passwordStrength(password_change);
|
||||
return (strength?.contains.includes("lowercase") &&
|
||||
strength?.contains.includes("uppercase") &&
|
||||
strength?.contains.includes("number") &&
|
||||
strength?.length > 9 &&
|
||||
passwords_match == true;
|
||||
strength?.length > 9);
|
||||
}
|
||||
export function password_strong_enough_and_equal(password_change, password_confirm){
|
||||
return password_strong_enough(password_change) && password_change === password_confirm;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import { getLocaleFromNavigator, _ } from "svelte-i18n";
|
||||
import { passwordStrength as Strength } from "check-password-strength";
|
||||
export let password_change;
|
||||
export let password_confirm;
|
||||
|
||||
$: strength = Strength(password_change);
|
||||
$: passwords_match =
|
||||
!password_confirm || password_confirm === password_change;
|
||||
</script>
|
||||
|
||||
<div class="ml-4">
|
||||
|
||||
Reference in New Issue
Block a user