fix: don't use name length for the recovery password input and trim it

pull/3137/head
yougotwill 8 months ago
parent e66d443a97
commit d52461aecc

@ -133,13 +133,15 @@ export const RestoreAccount = () => {
if (!(!!recoveryPassword && !recoveryPasswordError)) { if (!(!!recoveryPassword && !recoveryPasswordError)) {
return; return;
} }
const trimmedPassword = recoveryPassword.trim();
setRecoveryPassword(trimmedPassword);
const abortController = new AbortController(); const abortController = new AbortController();
try { try {
dispatch(setProgress(0)); dispatch(setProgress(0));
dispatch(setAccountRestorationStep(AccountRestoration.Loading)); dispatch(setAccountRestorationStep(AccountRestoration.Loading));
await signInAndFetchDisplayName({ await signInAndFetchDisplayName({
recoveryPassword, recoveryPassword: trimmedPassword,
dispatch, dispatch,
abortSignal: abortController.signal, abortSignal: abortController.signal,
}); });
@ -248,7 +250,6 @@ export const RestoreAccount = () => {
}} }}
onEnterPressed={recoverAndFetchDisplayName} onEnterPressed={recoverAndFetchDisplayName}
error={recoveryPasswordError} error={recoveryPasswordError}
maxLength={LIBSESSION_CONSTANTS.CONTACT_MAX_NAME_LENGTH}
enableShowHideButton={true} enableShowHideButton={true}
showHideButtonAriaLabels={{ showHideButtonAriaLabels={{
hide: 'Hide recovery password toggle', hide: 'Hide recovery password toggle',
@ -289,6 +290,7 @@ export const RestoreAccount = () => {
}} }}
onEnterPressed={recoverAndEnterDisplayName} onEnterPressed={recoverAndEnterDisplayName}
error={displayNameError} error={displayNameError}
maxLength={LIBSESSION_CONSTANTS.CONTACT_MAX_NAME_LENGTH}
inputDataTestId="display-name-input" inputDataTestId="display-name-input"
/> />
<SpacerLG /> <SpacerLG />

Loading…
Cancel
Save