From d52461aecc1f6b5127f047c4d6bbb818f658a997 Mon Sep 17 00:00:00 2001 From: yougotwill Date: Wed, 31 Jul 2024 17:20:15 +1000 Subject: [PATCH] fix: don't use name length for the recovery password input and trim it --- ts/components/registration/stages/RestoreAccount.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ts/components/registration/stages/RestoreAccount.tsx b/ts/components/registration/stages/RestoreAccount.tsx index af3e7850b..cbfc3b320 100644 --- a/ts/components/registration/stages/RestoreAccount.tsx +++ b/ts/components/registration/stages/RestoreAccount.tsx @@ -133,13 +133,15 @@ export const RestoreAccount = () => { if (!(!!recoveryPassword && !recoveryPasswordError)) { return; } + const trimmedPassword = recoveryPassword.trim(); + setRecoveryPassword(trimmedPassword); const abortController = new AbortController(); try { dispatch(setProgress(0)); dispatch(setAccountRestorationStep(AccountRestoration.Loading)); await signInAndFetchDisplayName({ - recoveryPassword, + recoveryPassword: trimmedPassword, dispatch, abortSignal: abortController.signal, }); @@ -248,7 +250,6 @@ export const RestoreAccount = () => { }} onEnterPressed={recoverAndFetchDisplayName} error={recoveryPasswordError} - maxLength={LIBSESSION_CONSTANTS.CONTACT_MAX_NAME_LENGTH} enableShowHideButton={true} showHideButtonAriaLabels={{ hide: 'Hide recovery password toggle', @@ -289,6 +290,7 @@ export const RestoreAccount = () => { }} onEnterPressed={recoverAndEnterDisplayName} error={displayNameError} + maxLength={LIBSESSION_CONSTANTS.CONTACT_MAX_NAME_LENGTH} inputDataTestId="display-name-input" />