Skip to content

Commit

Permalink
fix: collateral password issue [LW-11953] (#1584)
Browse files Browse the repository at this point in the history
* fix: collateral password issue

* fix: resolve build issue on main
  • Loading branch information
greatertomi authored Dec 10, 2024
1 parent fef43f5 commit 594bbd0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ export const CollateralFooterSend = ({
const submitTx = async () => withSignTxConfirmation(submitCollateralTx, secretsUtil.password.value);

const handleClick = async () => {
onClaim();

if (!hasEnoughAda) {
return onClose();
}
try {
if (popupView && !isInMemory)
return await backgroundServices?.handleOpenBrowser({ section: BrowserViewSections.COLLATERAL_SETTINGS });
await submitTx();
onClaim();
toast.notify({ text: t('browserView.settings.wallet.collateral.toast.add') });
if (isInMemory) onClose();
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export const EnterPassword: VFC<EnterPasswordProps> = ({
const icon = mapOfWalletTypeIconProperties[kind];

const next = () => {
if (!password.value) {
console.error('Password is undefined');
return;
}

onGenerateKeys(password.value);
clearSecrets();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ export const WalletSetupPasswordStep = ({
const passwordConfirmationErrorMessage =
passHasBeenValidated && password !== passwordConfirmation ? translations.noMatchPassword : '';
const isNextEnabled = Boolean(
passHasBeenValidated &&
!passwordConfirmationErrorMessage &&
score >= minimumPassLevelRequired &&
password.value.length > 0
passHasBeenValidated && !passwordConfirmationErrorMessage && score >= minimumPassLevelRequired && password?.value
? password.value.length > 0
: false
);

const complexityBarList: BarStates = useMemo(() => getComplexityBarStateList(score), [score]);
Expand All @@ -79,7 +78,7 @@ export const WalletSetupPasswordStep = ({
description={translations.description}
onBack={onBack}
onNext={() => {
onNext({ password: password.value });
password.value ? onNext({ password: password.value }) : console.error('Password is undefined');
}}
isNextEnabled={isNextEnabled}
currentTimelineStep={WalletTimelineSteps.WALLET_SETUP}
Expand Down

0 comments on commit 594bbd0

Please sign in to comment.