Hide parent password/path when non-deriving (#586)
* Hide parent password/path when non-deriving * add test Co-authored-by: Github Actions <action@github.com>
This commit is contained in:
parent
db1eb0b3b8
commit
ff4209455e
@ -103,6 +103,12 @@ describe('Derive', () => {
|
||||
expect(wrapper.exists('[data-button-action="create derived account"]')).toBe(false);
|
||||
});
|
||||
|
||||
it('Password entry is hidden after checkbox is unchecked', () => {
|
||||
uncheck(wrapper.find('input[type="checkbox"]'));
|
||||
|
||||
expect(wrapper.exists('input[type="password"]')).toBe(false);
|
||||
});
|
||||
|
||||
it('"Create new root" button redirects to /account/create', () => {
|
||||
uncheck(wrapper.find('input[type="checkbox"]'));
|
||||
wrapper.find('[data-button-action="create root account"] button').simulate('click');
|
||||
|
||||
@ -123,41 +123,45 @@ function SelectParent ({ className, isLocked, onDerivationConfirmed, parentAddre
|
||||
</Label>
|
||||
)
|
||||
}
|
||||
<div ref={passwordInputRef}>
|
||||
<InputWithLabel
|
||||
data-export-password
|
||||
isError={!isProperParentPassword}
|
||||
isFocused
|
||||
label={t<string>('enter the password for the account you want to derive from')}
|
||||
onChange={_onParentPasswordEnter}
|
||||
type='password'
|
||||
value={parentPassword}
|
||||
/>
|
||||
{!!parentPassword && !isProperParentPassword && (
|
||||
<Warning
|
||||
isBelowInput
|
||||
isDanger
|
||||
>
|
||||
{t('Wrong password')}
|
||||
</Warning>
|
||||
)}
|
||||
</div>
|
||||
{isProperParentPassword && (
|
||||
{shouldAccountBeDerived && (
|
||||
<>
|
||||
<DerivationPath
|
||||
defaultPath={defaultPath}
|
||||
isError={!suriPath}
|
||||
onChange={setSuriPath}
|
||||
parentAddress={parentAddress}
|
||||
parentPassword={parentPassword}
|
||||
/>
|
||||
{!suriPath && (
|
||||
<Warning
|
||||
isBelowInput
|
||||
isDanger
|
||||
>
|
||||
{t('Incorrect derivation path')}
|
||||
</Warning>
|
||||
<div ref={passwordInputRef}>
|
||||
<InputWithLabel
|
||||
data-export-password
|
||||
isError={!isProperParentPassword}
|
||||
isFocused
|
||||
label={t<string>('enter the password for the account you want to derive from')}
|
||||
onChange={_onParentPasswordEnter}
|
||||
type='password'
|
||||
value={parentPassword}
|
||||
/>
|
||||
{!!parentPassword && !isProperParentPassword && (
|
||||
<Warning
|
||||
isBelowInput
|
||||
isDanger
|
||||
>
|
||||
{t('Wrong password')}
|
||||
</Warning>
|
||||
)}
|
||||
</div>
|
||||
{isProperParentPassword && (
|
||||
<>
|
||||
<DerivationPath
|
||||
defaultPath={defaultPath}
|
||||
isError={!suriPath}
|
||||
onChange={setSuriPath}
|
||||
parentAddress={parentAddress}
|
||||
parentPassword={parentPassword}
|
||||
/>
|
||||
{!suriPath && (
|
||||
<Warning
|
||||
isBelowInput
|
||||
isDanger
|
||||
>
|
||||
{t('Incorrect derivation path')}
|
||||
</Warning>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user