Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn users to only add custom networks that they trust #8789

Merged
merged 3 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,9 @@
"onlyConnectTrust": {
"message": "Only connect with sites you trust."
},
"onlyAddTrustedNetworks": {
"message": "A malicious Ethereum network provider can lie about the state of the blockchain and record your network activity. Only add custom networks you trust."
},
"optionalChainId": {
"message": "ChainID (optional)"
},
Expand Down
1 change: 1 addition & 0 deletions ui/app/pages/settings/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 0;

@media screen and (max-width: 575px) {
height: 69px;
Expand Down
11 changes: 11 additions & 0 deletions ui/app/pages/settings/networks-tab/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@
flex-direction: column;
width: 93%;
}

&--warning {
background-color: #FEFAE8;
border: 1px solid #FFD33D;
width: 93%;
border-radius: 5px;
box-sizing: border-box;
padding: 12px;
margin: 12px 0;
font-size: 12px;
}
}

&__network-form-label {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,15 @@ export default class NetworkForm extends PureComponent {
}
}

renderWarning () {
const { t } = this.context
return (
<div className="networks-tab__network-form-row--warning">
{t('onlyAddTrustedNetworks')}
</div>
)
}

render () {
const { t } = this.context
const {
Expand All @@ -258,6 +267,7 @@ export default class NetworkForm extends PureComponent {

return (
<div className="networks-tab__network-form">
{viewOnly ? null : this.renderWarning()}
{this.renderFormTextField(
'networkName',
'network-name',
Expand Down Expand Up @@ -320,5 +330,4 @@ export default class NetworkForm extends PureComponent {
</div>
)
}

}