From 5be26bff9f1e452ee50bbf7f28d080e927b76124 Mon Sep 17 00:00:00 2001 From: Anastasia Poupeney Date: Fri, 15 Jun 2018 10:22:29 +0200 Subject: [PATCH 1/6] add lost password hard reset the app on the lock screen --- src/components/IsUnlocked.js | 44 ++++++++++++++++++++++++++++++++++-- static/i18n/en/app.yml | 1 + 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/components/IsUnlocked.js b/src/components/IsUnlocked.js index 136b1066..f6dadf2e 100644 --- a/src/components/IsUnlocked.js +++ b/src/components/IsUnlocked.js @@ -4,6 +4,7 @@ import bcrypt from 'bcryptjs' import React, { Component } from 'react' import { connect } from 'react-redux' import { compose } from 'redux' +import { remote } from 'electron' import styled from 'styled-components' import { translate } from 'react-i18next' @@ -14,12 +15,15 @@ import IconLockScreen from 'icons/LockScreen' import get from 'lodash/get' import { setEncryptionKey } from 'helpers/db' +import hardReset from 'helpers/hardReset' import { fetchAccounts } from 'actions/accounts' import { isLocked, unlock } from 'reducers/application' import Box from 'components/base/Box' import InputPassword from 'components/base/InputPassword' +import Button from './base/Button/index' +import ConfirmModal from './base/Modal/ConfirmModal' type InputValue = { password: string, @@ -36,6 +40,8 @@ type Props = { type State = { inputValue: InputValue, incorrectPassword: boolean, + isHardResetting: boolean, + isHardResetModalOpened: boolean, } const mapStateToProps = state => ({ @@ -53,6 +59,8 @@ const defaultState = { password: '', }, incorrectPassword: false, + isHardResetting: false, + isHardResetModalOpened: false, } export const PageTitle = styled(Box).attrs({ @@ -96,6 +104,7 @@ class IsUnlocked extends Component { ...prev.inputValue, [key]: value, }, + incorrectPassword: false, })) handleSubmit = async (e: SyntheticEvent) => { @@ -117,8 +126,21 @@ class IsUnlocked extends Component { } } + handleOpenHardResetModal = () => this.setState({ isHardResetModalOpened: true }) + handleCloseHardResetModal = () => this.setState({ isHardResetModalOpened: false }) + + handleHardReset = async () => { + this.setState({ isHardResetting: true }) + try { + await hardReset() + remote.getCurrentWindow().webContents.reloadIgnoringCache() + } catch (err) { + this.setState({ isHardResetting: false }) + } + } + render() { - const { inputValue, incorrectPassword } = this.state + const { inputValue, incorrectPassword, isHardResetting, isHardResetModalOpened } = this.state const { isLocked, t } = this.props if (isLocked) { @@ -140,11 +162,29 @@ class IsUnlocked extends Component { type="password" onChange={this.handleChangeInput('password')} value={inputValue.password} - error={incorrectPassword && t('app:password.errorMessageIncorrectPassword')} + error={ + incorrectPassword && + inputValue.password.length && + t('app:password.errorMessageIncorrectPassword') + } /> + + ) } diff --git a/static/i18n/en/app.yml b/static/i18n/en/app.yml index 4ed1a761..e969be12 100644 --- a/static/i18n/en/app.yml +++ b/static/i18n/en/app.yml @@ -31,6 +31,7 @@ common: subTitle: Your application is locked description: Please enter your password to continue inputPlaceholder: Type your password + lostPassword: I lost my password sync: syncing: Syncing... upToDate: Up to date From 40116daf6080e6fa7dd71dc4327f5d3061ce422f Mon Sep 17 00:00:00 2001 From: Anastasia Poupeney Date: Fri, 15 Jun 2018 10:26:02 +0200 Subject: [PATCH 2/6] defaulting analytics toggle to false --- src/components/Onboarding/steps/Analytics.js | 2 +- src/reducers/settings.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Onboarding/steps/Analytics.js b/src/components/Onboarding/steps/Analytics.js index 40969dc8..d92720bc 100644 --- a/src/components/Onboarding/steps/Analytics.js +++ b/src/components/Onboarding/steps/Analytics.js @@ -19,7 +19,7 @@ type State = { } const INITIAL_STATE = { - analyticsToggle: true, + analyticsToggle: false, sentryLogsToggle: true, } diff --git a/src/reducers/settings.js b/src/reducers/settings.js index 2c28e884..eb6b8ec3 100644 --- a/src/reducers/settings.js +++ b/src/reducers/settings.js @@ -72,7 +72,7 @@ const INITIAL_STATE: SettingsState = { region, developerMode: !!process.env.__DEV__, loaded: false, - shareAnalytics: true, + shareAnalytics: false, sentryLogs: true, lastUsedVersion: __APP_VERSION__, } From e013682fcdb20908da0d46bd5c39c092d6c34323 Mon Sep 17 00:00:00 2001 From: Anastasia Poupeney Date: Fri, 15 Jun 2018 11:46:07 +0200 Subject: [PATCH 3/6] update reset hard modal and add ledger blue text to genuine check --- src/components/IsUnlocked.js | 21 ++++++++++++++++--- .../Onboarding/steps/GenuineCheck.js | 7 ++++++- src/components/base/Modal/ConfirmModal.js | 9 +++++++- src/icons/TriangleWarning.js | 16 ++++++++++++++ static/i18n/en/app.yml | 7 +++---- static/i18n/en/onboarding.yml | 3 ++- 6 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 src/icons/TriangleWarning.js diff --git a/src/components/IsUnlocked.js b/src/components/IsUnlocked.js index f6dadf2e..edfc44bb 100644 --- a/src/components/IsUnlocked.js +++ b/src/components/IsUnlocked.js @@ -11,7 +11,7 @@ import { translate } from 'react-i18next' import type { SettingsState as Settings } from 'reducers/settings' import type { T } from 'types/common' import IconLockScreen from 'icons/LockScreen' - +import IconTriangleWarning from 'icons/TriangleWarning' import get from 'lodash/get' import { setEncryptionKey } from 'helpers/db' @@ -138,7 +138,13 @@ class IsUnlocked extends Component { this.setState({ isHardResetting: false }) } } - + hardResetIconRender = () => { + return ( + + + + ) + } render() { const { inputValue, incorrectPassword, isHardResetting, isHardResetModalOpened } = this.state const { isLocked, t } = this.props @@ -182,8 +188,8 @@ class IsUnlocked extends Component { onReject={this.handleCloseHardResetModal} onConfirm={this.handleHardReset} title={t('app:settings.hardResetModal.title')} - subTitle={t('app:settings.hardResetModal.subTitle')} desc={t('app:settings.hardResetModal.desc')} + renderIcon={this.hardResetIconRender} /> ) @@ -204,3 +210,12 @@ export default compose( ), translate(), )(IsUnlocked) + +const IconWrapperCircle = styled(Box).attrs({})` + width: 50px; + height: 50px; + border-radius: 50%; + background: #ea2e4919; + text-align: -webkit-center; + justify-content: center; +` diff --git a/src/components/Onboarding/steps/GenuineCheck.js b/src/components/Onboarding/steps/GenuineCheck.js index bff77501..c4f97654 100644 --- a/src/components/Onboarding/steps/GenuineCheck.js +++ b/src/components/Onboarding/steps/GenuineCheck.js @@ -129,7 +129,12 @@ class GenuineCheck extends PureComponent { {t('onboarding:genuineCheck.title')} - {t('onboarding:genuineCheck.desc')} + {onboarding.isLedgerNano ? ( + {t('onboarding:genuineCheck.descNano')} + ) : ( + {t('onboarding:genuineCheck.descBlue')} + )} + diff --git a/src/components/base/Modal/ConfirmModal.js b/src/components/base/Modal/ConfirmModal.js index 750f9b3f..c4c29f7e 100644 --- a/src/components/base/Modal/ConfirmModal.js +++ b/src/components/base/Modal/ConfirmModal.js @@ -14,8 +14,9 @@ type Props = { isOpened: boolean, isDanger: boolean, title: string, - subTitle: string, + subTitle?: string, desc: string, + renderIcon?: Function, confirmText?: string, cancelText?: string, onReject: Function, @@ -37,6 +38,7 @@ class ConfirmModal extends PureComponent { onReject, onConfirm, isLoading, + renderIcon, t, ...props } = this.props @@ -57,6 +59,11 @@ class ConfirmModal extends PureComponent { {subTitle} )} + {renderIcon && ( + + {renderIcon()} + + )} {desc} diff --git a/src/icons/TriangleWarning.js b/src/icons/TriangleWarning.js new file mode 100644 index 00000000..569fff9d --- /dev/null +++ b/src/icons/TriangleWarning.js @@ -0,0 +1,16 @@ +// @flow + +import React from 'react' + +const path = ( + +) + +export default ({ height, width, ...p }: { height: number, width: number }) => ( + + {path} + +) diff --git a/static/i18n/en/app.yml b/static/i18n/en/app.yml index e969be12..4b00bb11 100644 --- a/static/i18n/en/app.yml +++ b/static/i18n/en/app.yml @@ -119,7 +119,7 @@ exchange: coinmama: 'Coinmama is a financial service that makes it fast, safe and fun to buy digital currency, anywhere in the world.' genuinecheck: modal: - title: Genuine check, bro + title: Genuine check addAccounts: title: Add accounts breadcrumb: @@ -307,9 +307,8 @@ settings: terms: Terms and Privacy policy termsDesc: Lorem ipsum dolor sit amet hardResetModal: - title: Hard reset - subTitle: Are you sure houston? - desc: Lorem ipsum dolor sit amet + title: Reset Ledger Live + desc: Resetting will erase all Ledger Live data stored on your computer, including your profile, accounts, transaction history and application settings. The keys to access your crypto assets in the blockchain remain secure on your Ledger device. softResetModal: title: Clean application cache subTitle: Are you sure houston? diff --git a/static/i18n/en/onboarding.yml b/static/i18n/en/onboarding.yml index 2fa67577..d09f78e2 100644 --- a/static/i18n/en/onboarding.yml +++ b/static/i18n/en/onboarding.yml @@ -74,7 +74,8 @@ writeSeed: note4: Never use a device supplied with a recovery phrase and/or a PIN code. genuineCheck: title: Final security check - desc: Your Ledger Nano S should now display Your device is now ready. Before getting started, please confirm that + descNano: Your Ledger Nano S should now display Your device is now ready. Before getting started, please confirm that + descBlue: Your Ledger Blue should now display Your device is now ready. Before getting started, please confirm that steps: step1: title: Did you choose your PIN code by yourself? From ff620becdb6e9a299649d2a26e4262d1fdb7e4e1 Mon Sep 17 00:00:00 2001 From: Anastasia Poupeney Date: Fri, 15 Jun 2018 11:55:04 +0200 Subject: [PATCH 4/6] account name input length increased to 30 --- src/components/modals/AccountSettingRenderBody.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/modals/AccountSettingRenderBody.js b/src/components/modals/AccountSettingRenderBody.js index 60968fd2..95bb68fa 100644 --- a/src/components/modals/AccountSettingRenderBody.js +++ b/src/components/modals/AccountSettingRenderBody.js @@ -151,6 +151,7 @@ class HelperComp extends PureComponent { } onFocus={e => this.handleFocus(e, 'accountName')} From ae326792a44254ec934a6b49e75a9134a81257fe Mon Sep 17 00:00:00 2001 From: Anastasia Poupeney Date: Fri, 15 Jun 2018 11:58:09 +0200 Subject: [PATCH 5/6] lint fix --- src/components/IsUnlocked.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/IsUnlocked.js b/src/components/IsUnlocked.js index edfc44bb..e8ca9c8a 100644 --- a/src/components/IsUnlocked.js +++ b/src/components/IsUnlocked.js @@ -138,13 +138,11 @@ class IsUnlocked extends Component { this.setState({ isHardResetting: false }) } } - hardResetIconRender = () => { - return ( + hardResetIconRender = () => ( ) - } render() { const { inputValue, incorrectPassword, isHardResetting, isHardResetModalOpened } = this.state const { isLocked, t } = this.props From b6a1045716763a2df409b65f902aa9169e1e0c0d Mon Sep 17 00:00:00 2001 From: Anastasia Poupeney Date: Fri, 15 Jun 2018 12:06:50 +0200 Subject: [PATCH 6/6] adding design style to reset modal in settings as well --- src/components/IsUnlocked.js | 14 +++++-------- .../SettingsPage/sections/Profile.js | 20 ++++++++++++++++++- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/components/IsUnlocked.js b/src/components/IsUnlocked.js index e8ca9c8a..c0cb10e3 100644 --- a/src/components/IsUnlocked.js +++ b/src/components/IsUnlocked.js @@ -139,10 +139,10 @@ class IsUnlocked extends Component { } } hardResetIconRender = () => ( - - - - ) + + + + ) render() { const { inputValue, incorrectPassword, isHardResetting, isHardResetModalOpened } = this.state const { isLocked, t } = this.props @@ -166,11 +166,7 @@ class IsUnlocked extends Component { type="password" onChange={this.handleChangeInput('password')} value={inputValue.password} - error={ - incorrectPassword && - inputValue.password.length && - t('app:password.errorMessageIncorrectPassword') - } + error={incorrectPassword && t('app:password.errorMessageIncorrectPassword')} />