1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

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

This commit is contained in:
Niranjana Binoy 2022-07-18 20:17:43 -04:00 committed by GitHub
parent e38cc863a4
commit 2223e81c67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

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

View File

@ -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');
}