Added a password strength verification

ref #106
This commit is contained in:
Nicolai Ort 2021-03-26 19:26:26 +01:00
parent 5fa9939696
commit ad3bd312e9

View File

@ -1,14 +1,18 @@
<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))
$: passwords_match =
!password_confirm || password_confirm === password_change;
$: update_password_enabled =
strength?.contains.includes("lowercase") &&
strength?.contains.includes("uppercase") &&
strength?.contains.includes("number") &&
strength?.length > 9 &&
passwords_match == true;
</script>
<div class="ml-4">
{(passwords_match)}
<ul class="list-disc font-medium tracking-wide text-red-500 text-xs">
{#if !strength.contains.includes('lowercase')}
<li>Must contain a lowercase letter!</li>
@ -19,10 +23,10 @@
{#if !strength.contains.includes('number')}
<li>Must contain a number letter!</li>
{/if}
{#if !(strength.length>9)}
{#if !(strength.length > 9)}
<li>Must be at least 10 characters long!</li>
{/if}
{#if !(passwords_match==true)}
{#if !(passwords_match == true)}
<li>Passwords don't match!</li>
{/if}
</ul>