Disable Seedphrase import button if any of the characters is in uppercase (#15186)

feature/default_network_editable
Niranjana Binoy 2 years ago committed by GitHub
parent e38cc863a4
commit 2223e81c67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/_locales/en/messages.json
  2. 6
      ui/components/app/srp-input/srp-input.js

@ -1638,6 +1638,9 @@
"invalidSeedPhrase": {
"message": "Invalid Secret Recovery Phrase"
},
"invalidSeedPhraseCaseSensitive": {
"message": "Invalid input! Secret Recovery Phrase is case sensitive."
},
"ipfsGateway": {
"message": "IPFS Gateway"
},

@ -19,6 +19,10 @@ const { isValidMnemonic } = ethers.utils;
const defaultNumberOfWords = 12;
const hasUpperCase = (draftSrp) => {
return draftSrp !== draftSrp.toLowerCase();
};
export default function SrpInput({ onChange, srpText }) {
const [srpError, setSrpError] = useState('');
const [pasteFailed, setPasteFailed] = useState(false);
@ -40,6 +44,8 @@ export default function SrpInput({ onChange, srpText }) {
if (newDraftSrp.some((word) => word !== '')) {
if (newDraftSrp.some((word) => word === '')) {
newSrpError = t('seedPhraseReq');
} else if (hasUpperCase(joinedDraftSrp)) {
newSrpError = t('invalidSeedPhraseCaseSensitive');
} else if (!isValidMnemonic(joinedDraftSrp)) {
newSrpError = t('invalidSeedPhrase');
}

Loading…
Cancel
Save