diff --git a/CHANGELOG.md b/CHANGELOG.md index 406da2d4fb..77c28cac95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## 0.60.0-beta.x + +Changes: + +- Show warning on JSON import to store accounts externally (same as create) + + ## 0.59.1 Sep 21, 2020 Contributed: diff --git a/packages/page-accounts/src/modals/Create.tsx b/packages/page-accounts/src/modals/Create.tsx index 2ff63b2d12..2e8d6f9ba0 100644 --- a/packages/page-accounts/src/modals/Create.tsx +++ b/packages/page-accounts/src/modals/Create.tsx @@ -20,6 +20,7 @@ import { getEnvironment } from '@polkadot/react-api/util'; import { useTranslation } from '../translate'; import CreateConfirmation from './CreateConfirmation'; +import ExternalWarning from './ExternalWarning'; import PasswordInput from './PasswordInput'; interface Props extends ModalProps { @@ -54,7 +55,6 @@ interface DeriveValidationOutput { } const DEFAULT_PAIR_TYPE = 'sr25519'; -const isElectron = navigator.userAgent.toLowerCase().indexOf(' electron/') > -1; function deriveValidate (seed: string, seedType: SeedType, derivePath: string, pairType: KeypairType): DeriveValidationOutput { try { @@ -339,11 +339,7 @@ function Create ({ className = '', onClose, onStatusChange, seed: propsSeed, typ onChange={_onPasswordChange} onEnter={_onCommit} /> - {!isElectron && ( -
-

{t('Consider storing your account in a signer such as a browser extension, hardware device, QR-capable phone wallet (non-connected) or desktop application for optimal account security.')} {t('Future versions of the web-only interface will drop support for non-external accounts, much like the IPFS version.')}

-
- )} + -1; + +function ExternalWarning (): React.ReactElement | null { + const { t } = useTranslation(); + + if (isElectron) { + return null; + } + + return ( +
+

{t('Consider storing your account in a signer such as a browser extension, hardware device, QR-capable phone wallet (non-connected) or desktop application for optimal account security.')} {t('Future versions of the web-only interface will drop support for non-external accounts, much like the IPFS version.')}

+
+ ); +} + +export default React.memo(ExternalWarning); diff --git a/packages/page-accounts/src/modals/Import.tsx b/packages/page-accounts/src/modals/Import.tsx index eb28779921..168ed787d9 100644 --- a/packages/page-accounts/src/modals/Import.tsx +++ b/packages/page-accounts/src/modals/Import.tsx @@ -12,6 +12,7 @@ import { blake2AsU8a } from '@polkadot/util-crypto'; import keyring from '@polkadot/ui-keyring'; import { useTranslation } from '../translate'; +import ExternalWarning from './ExternalWarning'; interface Props extends ModalProps { className?: string; @@ -163,6 +164,7 @@ function Import ({ className = '', onClose, onStatusChange }: Props): React.Reac

{t('The password previously used to encrypt this account.')}

+