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:
parent
e38cc863a4
commit
2223e81c67
3
app/_locales/en/messages.json
generated
3
app/_locales/en/messages.json
generated
@ -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…
Reference in New Issue
Block a user