From 390f71b0c67dd78f20ccc4f9b7cc4087bb966fbe Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 12 Feb 2024 17:32:24 +0100 Subject: [PATCH] feat(registration): improve username and password validation Username and password are validated in the api for length and whitespaces. Previously, the api would tell the user "hey you got it wrong" but the error was not reflected properly in the UI. This change implements a client-side validation which mirrors the one from the api, allowing instant validation and better error UX. --- frontend/src/components/input/password.vue | 31 ++++++++++++---- frontend/src/i18n/lang/en.json | 4 ++ frontend/src/views/user/Register.vue | 43 +++++++++++++++++----- 3 files changed, 61 insertions(+), 17 deletions(-) diff --git a/frontend/src/components/input/password.vue b/frontend/src/components/input/password.vue index 06fde802c..d6812a5fc 100644 --- a/frontend/src/components/input/password.vue +++ b/frontend/src/components/input/password.vue @@ -10,7 +10,8 @@ autocomplete="current-password" :tabindex="props.tabindex" @keyup.enter="e => $emit('submit', e)" - @focusout="validate" + @focusout="() => {validate(); validateAfterFirst = true}" + @keyup="() => {validateAfterFirst ? validate() : null}" @input="handleInput" >

- {{ $t('user.auth.passwordRequired') }} + {{ isValid }}