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