eth_sign where account === undefined (#4964)

* Update for case where account === undefined

* Update tests to not mask account === undefined

* default account = {} where undefined (thanks @tomusdrw)
This commit is contained in:
Jaco Greeff 2017-03-21 16:58:52 +01:00 committed by GitHub
parent 1a6f23ad2b
commit cb881108c3
2 changed files with 13 additions and 6 deletions

View File

@ -27,7 +27,7 @@ import styles from './transactionPendingFormConfirm.css';
export default class TransactionPendingFormConfirm extends Component {
static propTypes = {
account: PropTypes.object.isRequired,
account: PropTypes.object,
address: PropTypes.string.isRequired,
disabled: PropTypes.bool,
isSending: PropTypes.bool.isRequired,
@ -36,6 +36,7 @@ export default class TransactionPendingFormConfirm extends Component {
};
static defaultProps = {
account: {},
focus: false
};
@ -80,7 +81,7 @@ export default class TransactionPendingFormConfirm extends Component {
getPasswordHint () {
const { account } = this.props;
const accountHint = account && account.meta && account.meta.passwordHint;
const accountHint = account.meta && account.meta.passwordHint;
if (accountHint) {
return accountHint;
@ -149,14 +150,16 @@ export default class TransactionPendingFormConfirm extends Component {
const { account } = this.props;
const { password } = this.state;
if (account && account.hardware) {
if (account.hardware) {
return null;
}
const isAccount = account.uuid;
return (
<Input
hint={
account.uuid
isAccount
? (
<FormattedMessage
id='signer.txPendingConfirm.password.unlock.hint'
@ -171,7 +174,7 @@ export default class TransactionPendingFormConfirm extends Component {
)
}
label={
account.uuid
isAccount
? (
<FormattedMessage
id='signer.txPendingConfirm.password.unlock.label'

View File

@ -48,7 +48,7 @@ function render (address) {
component = shallow(
<TransactionPendingFormConfirm
account={ ACCOUNTS[address] || {} }
account={ ACCOUNTS[address] }
address={ address }
onConfirm={ onConfirm }
isSending={ false }
@ -130,5 +130,9 @@ describe('views/Signer/TransactionPendingFormConfirm', () => {
it('renders the password', () => {
expect(instance.renderPassword()).not.to.be.null;
});
it('renders the hint', () => {
expect(instance.renderHint()).to.be.null;
});
});
});