aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/first-time/init-menu.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-03-27 15:20:35 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-03-27 15:20:35 +0800
commit6f367a5a6b4fb8918405f233293dc3f4840b4a3d (patch)
treec60c01300c90204f8634d1f3e9e79b4ecc2fceda /ui/app/first-time/init-menu.js
parent72ffa2c3f5abbcb06c8ab5fdf20b9d934c330692 (diff)
parente001c0900b5256c0c8769f0c3eb5d2007f5b18d3 (diff)
downloadtangerine-wallet-browser-6f367a5a6b4fb8918405f233293dc3f4840b4a3d.tar.gz
tangerine-wallet-browser-6f367a5a6b4fb8918405f233293dc3f4840b4a3d.tar.zst
tangerine-wallet-browser-6f367a5a6b4fb8918405f233293dc3f4840b4a3d.zip
Fix merge conflicts
Diffstat (limited to 'ui/app/first-time/init-menu.js')
-rw-r--r--ui/app/first-time/init-menu.js55
1 files changed, 43 insertions, 12 deletions
diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js
index addcedc77..8d63d5970 100644
--- a/ui/app/first-time/init-menu.js
+++ b/ui/app/first-time/init-menu.js
@@ -6,8 +6,11 @@ const PropTypes = require('prop-types')
const Mascot = require('../components/mascot')
const actions = require('../actions')
const Tooltip = require('../components/tooltip')
+const t = require('../../i18n')
const getCaretCoordinates = require('textarea-caret')
const { RESTORE_VAULT_ROUTE, DEFAULT_ROUTE } = require('../routes')
+const environmentType = require('../../../app/scripts/lib/environment-type')
+const { OLD_UI_NETWORK_TYPE } = require('../../../app/scripts/config').enums
class InitializeMenuScreen extends Component {
constructor (props) {
@@ -31,7 +34,6 @@ class InitializeMenuScreen extends Component {
}
render () {
- const { history } = this.props
const { warning } = this.state
return (
@@ -48,8 +50,7 @@ class InitializeMenuScreen extends Component {
color: '#7F8082',
marginBottom: 10,
},
- }, 'MetaMask'),
-
+ }, t('appName')),
h('div', [
h('h3', {
@@ -58,10 +59,10 @@ class InitializeMenuScreen extends Component {
color: '#7F8082',
display: 'inline',
},
- }, 'Encrypt your new DEN'),
+ }, t('encryptNewDen')),
h(Tooltip, {
- title: 'Your DEN is your password-encrypted storage within MetaMask.',
+ title: t('denExplainer'),
}, [
h('i.fa.fa-question-circle.pointer', {
style: {
@@ -81,7 +82,7 @@ class InitializeMenuScreen extends Component {
h('input.large-input.letter-spacey', {
type: 'password',
id: 'password-box',
- placeholder: 'New Password (min 8 chars)',
+ placeholder: t('newPassword'),
onInput: this.inputChanged.bind(this),
style: {
width: 260,
@@ -93,7 +94,7 @@ class InitializeMenuScreen extends Component {
h('input.large-input.letter-spacey', {
type: 'password',
id: 'password-box-confirm',
- placeholder: 'Confirm Password',
+ placeholder: t('confirmPassword'),
onKeyPress: this.createVaultOnEnter.bind(this),
onInput: this.inputChanged.bind(this),
style: {
@@ -108,17 +109,29 @@ class InitializeMenuScreen extends Component {
style: {
margin: 12,
},
- }, 'Create'),
+ }, t('createDen')),
h('.flex-row.flex-center.flex-grow', [
h('p.pointer', {
- onClick: () => history.push(RESTORE_VAULT_ROUTE),
+ onClick: () => this.showRestoreVault(),
style: {
fontSize: '0.8em',
color: 'rgb(247, 134, 28)',
textDecoration: 'underline',
},
- }, 'Import Existing DEN'),
+ }, t('importDen')),
+ ]),
+
+ h('.flex-row.flex-center.flex-grow', [
+ h('p.pointer', {
+ onClick: this.showOldUI.bind(this),
+ style: {
+ fontSize: '0.8em',
+ color: '#aeaeae',
+ textDecoration: 'underline',
+ marginTop: '32px',
+ },
+ }, 'Use classic interface'),
]),
])
@@ -142,11 +155,12 @@ class InitializeMenuScreen extends Component {
this.setState({ warning: null })
if (password.length < 8) {
- this.setState({ warning: 'password not long enough' })
+ this.setState({ warning: t('passwordShort') })
return
}
+
if (password !== passwordConfirm) {
- this.setState({ warning: 'passwords don\'t match' })
+ this.setState({ warning: t('passwordMismatch') })
return
}
@@ -164,6 +178,20 @@ class InitializeMenuScreen extends Component {
y: boundingRect.top + coordinates.top - element.scrollTop,
})
}
+
+ showRestoreVault () {
+ this.props.markPasswordForgotten()
+ if (environmentType() === 'popup') {
+ global.platform.openExtensionInBrowser()
+ }
+
+ this.props.history.push(RESTORE_VAULT_ROUTE)
+ }
+
+ showOldUI () {
+ this.props.dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
+ .then(() => this.props.dispatch(actions.setNetworkEndpoints(OLD_UI_NETWORK_TYPE)))
+ }
}
InitializeMenuScreen.propTypes = {
@@ -171,6 +199,8 @@ InitializeMenuScreen.propTypes = {
isInitialized: PropTypes.bool,
isUnlocked: PropTypes.bool,
createNewVaultAndKeychain: PropTypes.func,
+ markPasswordForgotten: PropTypes.func,
+ dispatch: PropTypes.func,
}
const mapStateToProps = state => {
@@ -185,6 +215,7 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => {
return {
createNewVaultAndKeychain: password => dispatch(actions.createNewVaultAndKeychain(password)),
+ markPasswordForgotten: () => dispatch(actions.markPasswordForgotten()),
}
}