From 038e69fd0273335c7fe6f08290d1c20a97ed5e84 Mon Sep 17 00:00:00 2001 From: Jan108 Date: Sat, 24 Feb 2024 21:28:56 +0100 Subject: [PATCH] feat(web): Added password field visibility toggle (#7368) * Added password field visibility toggle * improvements to password input field * fix e2e and change tabindex * add missing name=password * remove unnecessary type prop --------- Co-authored-by: Jan108 Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> --- .../forms/admin-registration-form.svelte | 25 ++-------- .../forms/change-password-form.svelte | 21 ++------ .../components/forms/create-user-form.svelte | 16 ++---- .../lib/components/forms/login-form.svelte | 11 +--- .../shared-components/password-field.svelte | 50 +++++++++++++++++++ .../settings/setting-input-field.svelte | 49 ++++++++++++------ .../change-password-settings.svelte | 3 ++ 7 files changed, 101 insertions(+), 74 deletions(-) create mode 100644 web/src/lib/components/shared-components/password-field.svelte diff --git a/web/src/lib/components/forms/admin-registration-form.svelte b/web/src/lib/components/forms/admin-registration-form.svelte index 144e1711da..0781ef226b 100644 --- a/web/src/lib/components/forms/admin-registration-form.svelte +++ b/web/src/lib/components/forms/admin-registration-form.svelte @@ -4,14 +4,15 @@ import { signUpAdmin } from '@immich/sdk'; import { handleError } from '../../utils/handle-error'; import Button from '../elements/buttons/button.svelte'; + import PasswordField from '../shared-components/password-field.svelte'; let errorMessage: string; let password = ''; - let confirmPassowrd = ''; + let confirmPassword = ''; let canRegister = false; $: { - if (password !== confirmPassowrd && confirmPassowrd.length > 0) { + if (password !== confirmPassword && confirmPassword.length > 0) { errorMessage = 'Password does not match'; canRegister = false; } else { @@ -56,28 +57,12 @@
- +
- +
diff --git a/web/src/lib/components/forms/change-password-form.svelte b/web/src/lib/components/forms/change-password-form.svelte index c33a93e5df..8e0d4d6f82 100644 --- a/web/src/lib/components/forms/change-password-form.svelte +++ b/web/src/lib/components/forms/change-password-form.svelte @@ -1,6 +1,7 @@ + +
+ { + password = e.currentTarget.value; + onInput?.(password); + }} + /> + + {#if password.length > 0} + + {/if} +
+ + diff --git a/web/src/lib/components/shared-components/settings/setting-input-field.svelte b/web/src/lib/components/shared-components/settings/setting-input-field.svelte index 83cd0e71e2..8e966c8f5f 100644 --- a/web/src/lib/components/shared-components/settings/setting-input-field.svelte +++ b/web/src/lib/components/shared-components/settings/setting-input-field.svelte @@ -10,6 +10,7 @@