aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-10-13 08:12:52 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-10-13 08:12:52 +0800
commit7cba71fc5590af115997f8120ac59f1293d6e2b9 (patch)
tree9028874304e96f0aa543e707c25eedce660aace0 /ui
parent8d5b2478e3aa939cb4b0a58b20b199cded62769e (diff)
parentcd2c00a31873490c9129023abb35dd7983604b60 (diff)
downloadtangerine-wallet-browser-7cba71fc5590af115997f8120ac59f1293d6e2b9.tar
tangerine-wallet-browser-7cba71fc5590af115997f8120ac59f1293d6e2b9.tar.gz
tangerine-wallet-browser-7cba71fc5590af115997f8120ac59f1293d6e2b9.tar.bz2
tangerine-wallet-browser-7cba71fc5590af115997f8120ac59f1293d6e2b9.tar.lz
tangerine-wallet-browser-7cba71fc5590af115997f8120ac59f1293d6e2b9.tar.xz
tangerine-wallet-browser-7cba71fc5590af115997f8120ac59f1293d6e2b9.tar.zst
tangerine-wallet-browser-7cba71fc5590af115997f8120ac59f1293d6e2b9.zip
Merge branch 'i328-MultiVault' of github.com:MetaMask/metamask-plugin into origin/i328-MultiVault
Diffstat (limited to 'ui')
-rw-r--r--ui/app/actions.js82
-rw-r--r--ui/app/app.js18
-rw-r--r--ui/app/config.js16
-rw-r--r--ui/app/first-time/create-vault-complete.js74
-rw-r--r--ui/app/first-time/init-menu.js20
-rw-r--r--ui/app/first-time/restore-vault.js148
-rw-r--r--ui/app/recover-seed/confirmation.js148
7 files changed, 5 insertions, 501 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 0cce9065e..4f3083707 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -16,10 +16,6 @@ var actions = {
SHOW_INIT_MENU: 'SHOW_INIT_MENU',
SHOW_NEW_VAULT_SEED: 'SHOW_NEW_VAULT_SEED',
SHOW_INFO_PAGE: 'SHOW_INFO_PAGE',
- RECOVER_FROM_SEED: 'RECOVER_FROM_SEED',
- CLEAR_SEED_WORD_CACHE: 'CLEAR_SEED_WORD_CACHE',
- clearSeedWordCache: clearSeedWordCache,
- recoverFromSeed: recoverFromSeed,
unlockMetamask: unlockMetamask,
unlockFailed: unlockFailed,
showCreateVault: showCreateVault,
@@ -29,10 +25,6 @@ var actions = {
createNewVaultInProgress: createNewVaultInProgress,
showNewVaultSeed: showNewVaultSeed,
showInfoPage: showInfoPage,
- // seed recovery actions
- REVEAL_SEED_CONFIRMATION: 'REVEAL_SEED_CONFIRMATION',
- revealSeedConfirmation: revealSeedConfirmation,
- requestRevealSeed: requestRevealSeed,
// unlock screen
UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS',
UNLOCK_FAILED: 'UNLOCK_FAILED',
@@ -53,8 +45,6 @@ var actions = {
SHOW_ACCOUNTS_PAGE: 'SHOW_ACCOUNTS_PAGE',
SHOW_CONF_TX_PAGE: 'SHOW_CONF_TX_PAGE',
SHOW_CONF_MSG_PAGE: 'SHOW_CONF_MSG_PAGE',
- REVEAL_ACCOUNT: 'REVEAL_ACCOUNT',
- revealAccount: revealAccount,
SET_CURRENT_FIAT: 'SET_CURRENT_FIAT',
setCurrentFiat: setCurrentFiat,
// account detail screen
@@ -95,7 +85,6 @@ var actions = {
backToAccountDetail: backToAccountDetail,
showAccountsPage: showAccountsPage,
showConfTxPage: showConfTxPage,
- confirmSeedWords: confirmSeedWords,
// config screen
SHOW_CONFIG_PAGE: 'SHOW_CONFIG_PAGE',
SET_RPC_TARGET: 'SET_RPC_TARGET',
@@ -182,41 +171,8 @@ function createNewVault (password, entropy) {
if (err) {
return dispatch(actions.showWarning(err.message))
}
- dispatch(actions.showNewVaultSeed(result))
- })
- }
-}
-
-function revealSeedConfirmation () {
- return {
- type: this.REVEAL_SEED_CONFIRMATION,
- }
-}
-
-function requestRevealSeed (password) {
- return (dispatch) => {
- dispatch(actions.showLoadingIndication())
- _accountManager.tryPassword(password, (err, seed) => {
- dispatch(actions.hideLoadingIndication())
- if (err) return dispatch(actions.displayWarning(err.message))
- _accountManager.recoverSeed((err, seed) => {
- if (err) return dispatch(actions.displayWarning(err.message))
- dispatch(actions.showNewVaultSeed(seed))
- })
- })
- }
-}
-
-function recoverFromSeed (password, seed) {
- return (dispatch) => {
- // dispatch(actions.createNewVaultInProgress())
- dispatch(actions.showLoadingIndication())
- _accountManager.recoverFromSeed(password, seed, (err, metamaskState) => {
- dispatch(actions.hideLoadingIndication())
- if (err) return dispatch(actions.displayWarning(err.message))
-
- var account = Object.keys(metamaskState.identities)[0]
- dispatch(actions.unlockMetamask(account))
+ dispatch(this.goHome())
+ dispatch(this.hideLoadingIndication())
})
}
}
@@ -233,19 +189,6 @@ function setSelectedAddress (address) {
}
}
-function revealAccount () {
- return (dispatch) => {
- dispatch(actions.showLoadingIndication())
- _accountManager.revealAccount((err) => {
- dispatch(actions.hideLoadingIndication())
- if (err) return dispatch(actions.displayWarning(err.message))
- dispatch({
- type: actions.REVEAL_ACCOUNT,
- })
- })
- }
-}
-
function setCurrentFiat (fiat) {
return (dispatch) => {
dispatch(this.showLoadingIndication())
@@ -451,27 +394,6 @@ function backToAccountDetail (address) {
value: address,
}
}
-function clearSeedWordCache (account) {
- return {
- type: actions.CLEAR_SEED_WORD_CACHE,
- value: account,
- }
-}
-
-function confirmSeedWords () {
- return (dispatch) => {
- dispatch(actions.showLoadingIndication())
- _accountManager.clearSeedWordCache((err, account) => {
- dispatch(actions.hideLoadingIndication())
- if (err) {
- return dispatch(actions.showWarning(err.message))
- }
-
- console.log('Seed word cache cleared. ' + account)
- dispatch(actions.showAccountDetail(account))
- })
- }
-}
function showAccountsPage () {
return {
diff --git a/ui/app/app.js b/ui/app/app.js
index 71e0637d0..3266ced51 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -8,8 +8,6 @@ const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
const DisclaimerScreen = require('./first-time/disclaimer')
const InitializeMenuScreen = require('./first-time/init-menu')
const CreateVaultScreen = require('./first-time/create-vault')
-const CreateVaultCompleteScreen = require('./first-time/create-vault-complete')
-const RestoreVaultScreen = require('./first-time/restore-vault')
// unlock
const UnlockScreen = require('./unlock')
// accounts
@@ -19,7 +17,6 @@ const SendTransactionScreen = require('./send')
const ConfirmTxScreen = require('./conf-tx')
// other views
const ConfigScreen = require('./config')
-const RevealSeedConfirmation = require('./recover-seed/confirmation')
const InfoScreen = require('./info')
const LoadingIndicator = require('./components/loading')
const SandwichExpando = require('sandwich-expando')
@@ -402,10 +399,6 @@ App.prototype.renderPrimary = function () {
return h(DisclaimerScreen, {key: 'disclaimerScreen'})
}
- if (props.seedWords) {
- return h(CreateVaultCompleteScreen, {key: 'createVaultComplete'})
- }
-
// show initialize screen
if (!props.isInitialized || props.forgottenPassword) {
// show current view
@@ -414,12 +407,6 @@ App.prototype.renderPrimary = function () {
case 'createVault':
return h(CreateVaultScreen, {key: 'createVault'})
- case 'restoreVault':
- return h(RestoreVaultScreen, {key: 'restoreVault'})
-
- case 'createVaultComplete':
- return h(CreateVaultCompleteScreen, {key: 'createVaultComplete'})
-
default:
return h(InitializeMenuScreen, {key: 'menuScreenInit'})
@@ -451,16 +438,15 @@ App.prototype.renderPrimary = function () {
case 'config':
return h(ConfigScreen, {key: 'config'})
- case 'reveal-seed-conf':
- return h(RevealSeedConfirmation, {key: 'reveal-seed-conf'})
-
case 'info':
return h(InfoScreen, {key: 'info'})
case 'createVault':
return h(CreateVaultScreen, {key: 'createVault'})
+
case 'buyEth':
return h(BuyView, {key: 'buyEthView'})
+
case 'qr':
return h('div', {
style: {
diff --git a/ui/app/config.js b/ui/app/config.js
index e09a38cd8..d4730e558 100644
--- a/ui/app/config.js
+++ b/ui/app/config.js
@@ -77,22 +77,6 @@ ConfigScreen.prototype.render = function () {
currentConversionInformation(metamaskState, state),
h('hr.horizontal-line'),
- h('div', {
- style: {
- marginTop: '20px',
- },
- }, [
- h('button', {
- style: {
- alignSelf: 'center',
- },
- onClick (event) {
- event.preventDefault()
- state.dispatch(actions.revealSeedConfirmation())
- },
- }, 'Reveal Seed Words'),
- ]),
-
]),
]),
])
diff --git a/ui/app/first-time/create-vault-complete.js b/ui/app/first-time/create-vault-complete.js
deleted file mode 100644
index 2b5413955..000000000
--- a/ui/app/first-time/create-vault-complete.js
+++ /dev/null
@@ -1,74 +0,0 @@
-const inherits = require('util').inherits
-const Component = require('react').Component
-const connect = require('react-redux').connect
-const h = require('react-hyperscript')
-const actions = require('../actions')
-
-module.exports = connect(mapStateToProps)(CreateVaultCompleteScreen)
-
-inherits(CreateVaultCompleteScreen, Component)
-function CreateVaultCompleteScreen () {
- Component.call(this)
-}
-
-function mapStateToProps (state) {
- return {
- seed: state.appState.currentView.seedWords,
- cachedSeed: state.metamask.seedWords,
- }
-}
-
-CreateVaultCompleteScreen.prototype.render = function () {
- var state = this.props
- var seed = state.seed || state.cachedSeed
-
- return (
-
- h('.initialize-screen.flex-column.flex-center.flex-grow', [
-
- // // subtitle and nav
- // h('.section-title.flex-row.flex-center', [
- // h('h2.page-subtitle', 'Vault Created'),
- // ]),
-
- h('h3.flex-center.text-transform-uppercase', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- marginTop: 36,
- marginBottom: 8,
- width: '100%',
- fontSize: '20px',
- padding: 6,
- },
- }, [
- 'Vault Created',
- ]),
-
- h('span.error', { // Error for the right red
- style: {
- padding: '12px 20px 0px 20px',
- textAlign: 'center',
- },
- }, 'These 12 words can restore all of your MetaMask accounts for this vault.\nSave them somewhere safe and secret.'),
-
- h('textarea.twelve-word-phrase', {
- readOnly: true,
- value: seed,
- }),
-
- h('button.primary', {
- onClick: () => this.confirmSeedWords(),
- style: {
- margin: '24px',
- fontSize: '0.9em',
- },
- }, 'I\'ve copied it somewhere safe'),
- ])
- )
-}
-
-CreateVaultCompleteScreen.prototype.confirmSeedWords = function () {
- this.props.dispatch(actions.confirmSeedWords())
-}
-
diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js
index 94a9d3df6..9b733d0e7 100644
--- a/ui/app/first-time/init-menu.js
+++ b/ui/app/first-time/init-menu.js
@@ -63,33 +63,15 @@ InitializeMenuScreen.prototype.renderMenu = function () {
h('.flex-row.flex-center.flex-grow', [
h('hr'),
- h('div', 'OR'),
+ h('div', 'Advanced (Eventually?)'),
h('hr'),
]),
- h('button.primary', {
- onClick: this.showRestoreVault.bind(this),
- style: {
- margin: 12,
- },
- }, 'Restore Existing Vault'),
])
)
}
-// InitializeMenuScreen.prototype.splitWor = function() {
-// this.props.dispatch(actions.showInitializeMenu())
-// }
-
-InitializeMenuScreen.prototype.showInitializeMenu = function () {
- this.props.dispatch(actions.showInitializeMenu())
-}
-
InitializeMenuScreen.prototype.showCreateVault = function () {
this.props.dispatch(actions.showCreateVault())
}
-InitializeMenuScreen.prototype.showRestoreVault = function () {
- this.props.dispatch(actions.showRestoreVault())
-}
-
diff --git a/ui/app/first-time/restore-vault.js b/ui/app/first-time/restore-vault.js
deleted file mode 100644
index 4c1f21008..000000000
--- a/ui/app/first-time/restore-vault.js
+++ /dev/null
@@ -1,148 +0,0 @@
-const inherits = require('util').inherits
-const PersistentForm = require('../../lib/persistent-form')
-const connect = require('react-redux').connect
-const h = require('react-hyperscript')
-const actions = require('../actions')
-
-module.exports = connect(mapStateToProps)(RestoreVaultScreen)
-
-inherits(RestoreVaultScreen, PersistentForm)
-function RestoreVaultScreen () {
- PersistentForm.call(this)
-}
-
-function mapStateToProps (state) {
- return {
- warning: state.appState.warning,
- }
-}
-
-RestoreVaultScreen.prototype.render = function () {
- var state = this.props
- this.persistentFormParentId = 'restore-vault-form'
-
- return (
-
- h('.initialize-screen.flex-column.flex-center.flex-grow', [
-
- h('h3.flex-center.text-transform-uppercase', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- marginBottom: 24,
- width: '100%',
- fontSize: '20px',
- padding: 6,
- },
- }, [
- 'Restore Vault',
- ]),
-
- // wallet seed entry
- h('h3', 'Wallet Seed'),
- h('textarea.twelve-word-phrase.letter-spacey', {
- dataset: {
- persistentFormId: 'wallet-seed',
- },
- placeholder: 'Enter your secret twelve word phrase here to restore your vault.',
- }),
-
- // password
- h('input.large-input.letter-spacey', {
- type: 'password',
- id: 'password-box',
- placeholder: 'New Password (min 8 chars)',
- dataset: {
- persistentFormId: 'password',
- },
- style: {
- width: 260,
- marginTop: 12,
- },
- }),
-
- // confirm password
- h('input.large-input.letter-spacey', {
- type: 'password',
- id: 'password-box-confirm',
- placeholder: 'Confirm Password',
- onKeyPress: this.onMaybeCreate.bind(this),
- dataset: {
- persistentFormId: 'password-confirmation',
- },
- style: {
- width: 260,
- marginTop: 16,
- },
- }),
-
- (state.warning) && (
- h('span.error.in-progress-notification', state.warning)
- ),
-
- // submit
-
- h('.flex-row.flex-space-between', {
- style: {
- marginTop: 30,
- width: '50%',
- },
- }, [
-
- // cancel
- h('button.primary', {
- onClick: this.showInitializeMenu.bind(this),
- }, 'CANCEL'),
-
- // submit
- h('button.primary', {
- onClick: this.restoreVault.bind(this),
- }, 'OK'),
-
- ]),
-
- ])
-
- )
-}
-
-RestoreVaultScreen.prototype.showInitializeMenu = function () {
- this.props.dispatch(actions.showInitializeMenu())
-}
-
-RestoreVaultScreen.prototype.onMaybeCreate = function (event) {
- if (event.key === 'Enter') {
- this.restoreVault()
- }
-}
-
-RestoreVaultScreen.prototype.restoreVault = function () {
- // check password
- var passwordBox = document.getElementById('password-box')
- var password = passwordBox.value
- var passwordConfirmBox = document.getElementById('password-box-confirm')
- var passwordConfirm = passwordConfirmBox.value
- if (password.length < 8) {
- this.warning = 'Password not long enough'
-
- this.props.dispatch(actions.displayWarning(this.warning))
- return
- }
- if (password !== passwordConfirm) {
- this.warning = 'Passwords don\'t match'
- this.props.dispatch(actions.displayWarning(this.warning))
- return
- }
- // check seed
- var seedBox = document.querySelector('textarea.twelve-word-phrase')
- var seed = seedBox.value.trim()
- if (seed.split(' ').length !== 12) {
- this.warning = 'seed phrases are 12 words long'
- this.props.dispatch(actions.displayWarning(this.warning))
- return
- }
- // submit
- this.warning = null
- this.props.dispatch(actions.displayWarning(this.warning))
- this.props.dispatch(actions.recoverFromSeed(password, seed))
-}
diff --git a/ui/app/recover-seed/confirmation.js b/ui/app/recover-seed/confirmation.js
deleted file mode 100644
index 55b18025f..000000000
--- a/ui/app/recover-seed/confirmation.js
+++ /dev/null
@@ -1,148 +0,0 @@
-const inherits = require('util').inherits
-
-const Component = require('react').Component
-const connect = require('react-redux').connect
-const h = require('react-hyperscript')
-const actions = require('../actions')
-
-module.exports = connect(mapStateToProps)(RevealSeedConfirmatoin)
-
-inherits(RevealSeedConfirmatoin, Component)
-function RevealSeedConfirmatoin () {
- Component.call(this)
-}
-
-function mapStateToProps (state) {
- return {
- warning: state.appState.warning,
- }
-}
-
-RevealSeedConfirmatoin.prototype.confirmationPhrase = 'I understand'
-
-RevealSeedConfirmatoin.prototype.render = function () {
- const props = this.props
- const state = this.state
-
- return (
-
- h('.initialize-screen.flex-column.flex-center.flex-grow', [
-
- h('h3.flex-center.text-transform-uppercase', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- marginBottom: 24,
- width: '100%',
- fontSize: '20px',
- padding: 6,
- },
- }, [
- 'Reveal Seed Words',
- ]),
-
- h('.div', {
- style: {
- display: 'flex',
- flexDirection: 'column',
- padding: '20px',
- justifyContent: 'center',
- },
- }, [
-
- h('h4', 'Do not recover your seed words in a public place! These words can be used to steal all your accounts.'),
-
- // confirmation
- h('input.large-input.letter-spacey', {
- type: 'password',
- id: 'password-box',
- placeholder: 'Enter your password to confirm',
- onKeyPress: this.checkConfirmation.bind(this),
- style: {
- width: 260,
- marginTop: '12px',
- },
- }),
-
- h(`h4${state && state.confirmationWrong ? '.error' : ''}`, {
- style: {
- marginTop: '12px',
- },
- }, 'Enter the phrase "I understand" to proceed.'),
-
- // confirm confirmation
- h('input.large-input.letter-spacey', {
- type: 'text',
- id: 'confirm-box',
- placeholder: this.confirmationPhrase,
- onKeyPress: this.checkConfirmation.bind(this),
- style: {
- width: 260,
- marginTop: 16,
- },
- }),
-
- h('.flex-row.flex-space-between', {
- style: {
- marginTop: 30,
- width: '50%',
- },
- }, [
-// cancel
- h('button.primary', {
- onClick: this.goHome.bind(this),
- }, 'CANCEL'),
-
- // submit
- h('button.primary', {
- onClick: this.revealSeedWords.bind(this),
- }, 'OK'),
-
- ]),
-
- (props.warning) && (
- h('span.error', {
- style: {
- margin: '20px',
- },
- }, props.warning.split('-'))
- ),
-
- props.inProgress && (
- h('span.in-progress-notification', 'Generating Seed...')
- ),
- ]),
- ])
- )
-}
-
-RevealSeedConfirmatoin.prototype.componentDidMount = function () {
- document.getElementById('password-box').focus()
-}
-
-RevealSeedConfirmatoin.prototype.goHome = function () {
- this.props.dispatch(actions.showConfigPage(false))
-}
-
-// create vault
-
-RevealSeedConfirmatoin.prototype.checkConfirmation = function (event) {
- if (event.key === 'Enter') {
- event.preventDefault()
- this.revealSeedWords()
- }
-}
-
-RevealSeedConfirmatoin.prototype.revealSeedWords = function () {
- this.setState({ confirmationWrong: false })
-
- const confirmBox = document.getElementById('confirm-box')
- const confirmation = confirmBox.value
- if (confirmation !== this.confirmationPhrase) {
- confirmBox.value = ''
- return this.setState({ confirmationWrong: true })
- }
-
- var password = document.getElementById('password-box').value
- this.props.dispatch(actions.requestRevealSeed(password))
-}