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

Make seed phrase import case-insensitive (#8246)

The user-specified seed phrase during the first-time-flow import step
required the phrase to be entered in all lowercase. The case does not
add any extra entropy to the seed, so there's no reason to be case
sensitive. Flexibility here will improve the onboarding UX.

This commit makes the entered seed phrase case-insensitive.

Fixes #8171
This commit is contained in:
marktoda 2020-03-30 05:51:04 -07:00 committed by GitHub
parent 007631171c
commit a761b9e15d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -2,6 +2,7 @@
## Current Develop Branch
- [#7912](https://github.com/MetaMask/metamask-extension/pull/7912): Disable import button for empty string/file
- [#8246](https://github.com/MetaMask/metamask-extension/pull/8246): Make seed phrase import case-insensitive
## 7.7.0 Thu Nov 28 2019
- [#7004](https://github.com/MetaMask/metamask-extension/pull/7004): Connect distinct accounts per site

View File

@ -41,7 +41,7 @@ export default class ImportWithSeedPhrase extends PureComponent {
return ''
}
const words = trimmed.match(/\w+/g)
const words = trimmed.toLowerCase().match(/\w+/g)
if (!words) {
return ''
}

View File

@ -34,6 +34,26 @@ describe('ImportWithSeedPhrase Component', function () {
assert.deepEqual(parseSeedPhrase('foo bar baz'), 'foo bar baz')
})
it('should handle a mixed-case seed phrase', function () {
const root = shallowRender({
onSubmit: sinon.spy(),
})
const { parseSeedPhrase } = root.instance()
assert.deepEqual(parseSeedPhrase('FOO bAr baZ'), 'foo bar baz')
})
it('should handle an upper-case seed phrase', function () {
const root = shallowRender({
onSubmit: sinon.spy(),
})
const { parseSeedPhrase } = root.instance()
assert.deepEqual(parseSeedPhrase('FOO BAR BAZ'), 'foo bar baz')
})
it('should trim extraneous whitespace from the given seed phrase', function () {
const root = shallowRender({
onSubmit: sinon.spy(),