Skip to content

Commit

Permalink
Merge pull request #4961 from whymarrh/download-seed-phrase
Browse files Browse the repository at this point in the history
Add download seed phrase link to new UI
  • Loading branch information
whymarrh authored Aug 14, 2018
2 parents e2be22a + 4dadeb9 commit 9ba91e6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
13 changes: 13 additions & 0 deletions mascara/src/app/first-time/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,19 @@
min-width: 0;
}

.backup-phrase__tips-text--link {
color: #2f9ae0;
cursor: pointer;
}

.backup-phrase__tips-text--link:hover {
color: #2f9ae0;
}

.backup-phrase__tips-text--strong {
font-weight: bold;
}

@media only screen and (max-width: 768px) {
.backup-phrase__content-wrapper {
flex-direction: column;
Expand Down
16 changes: 15 additions & 1 deletion mascara/src/app/first-time/seed-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import classnames from 'classnames'
import { withRouter } from 'react-router-dom'
import { compose } from 'recompose'
import Identicon from '../../../../ui/app/components/identicon'
import {exportAsFile} from '../../../../ui/app/util'
import Breadcrumbs from './breadcrumbs'
import LoadingScreen from './loading-screen'
import { DEFAULT_ROUTE, INITIALIZE_CONFIRM_SEED_ROUTE } from '../../../../ui/app/routes'
Expand Down Expand Up @@ -65,6 +66,12 @@ class BackupPhraseScreen extends Component {
}
}

exportSeedWords = () => {
const { seedWords } = this.props

exportAsFile('MetaMask Secret Backup Phrase', seedWords, 'text/plain')
}

renderSecretWordsContainer () {
const { isShowingSecret } = this.state

Expand Down Expand Up @@ -111,14 +118,21 @@ class BackupPhraseScreen extends Component {
<div className="backup-phrase__tips">
<div className="backup-phrase__tips-text">Tips:</div>
<div className="backup-phrase__tips-text">
Store this phrase in a password manager like 1password.
Store this phrase in a password manager like 1Password.
</div>
<div className="backup-phrase__tips-text">
Write this phrase on a piece of paper and store in a secure location. If you want even more security, write it down on multiple pieces of paper and store each in 2 - 3 different locations.
</div>
<div className="backup-phrase__tips-text">
Memorize this phrase.
</div>
<div className="backup-phrase__tips-text">
<strong>
<a className="backup-phrase__tips-text--link backup-phrase__tips-text--strong" onClick={this.exportSeedWords}>
Download this Secret Backup Phrase
</a>
</strong> and keep it stored safely on an external encrypted hard drive or storage medium.
</div>
</div>
<div className="backup-phrase__next-button">
<button
Expand Down
4 changes: 2 additions & 2 deletions ui/app/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ function getContractAtAddress (tokenAddress) {
return global.eth.contract(abi).at(tokenAddress)
}

function exportAsFile (filename, data) {
function exportAsFile (filename, data, type = 'text/csv') {
// source: https://stackoverflow.com/a/33542499 by Ludovic Feltz
const blob = new Blob([data], {type: 'text/csv'})
const blob = new Blob([data], {type})
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(blob, filename)
} else {
Expand Down

0 comments on commit 9ba91e6

Please sign in to comment.