Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Commit

Permalink
fix: rename memo -> note + add bip39 mnemonic check
Browse files Browse the repository at this point in the history
  • Loading branch information
serge1peshcoff committed Apr 23, 2021
1 parent 665303b commit a0661a9
Show file tree
Hide file tree
Showing 20 changed files with 59,345 additions and 11,534 deletions.
47,441 changes: 47,441 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {
"bip39": "^3.0.3"
}
}
6 changes: 3 additions & 3 deletions src/containers/Wallet/Proposals/Modal/Memo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as PropTypes from 'prop-types';
import { ValidateMemo } from './_validation';
import { ValidateMemo } from '../../../common/_validation';
import { connect } from 'react-redux';
import { setTxVoteMemo } from '../../../../actions/transactions/vote';
import React from 'react';
Expand All @@ -19,8 +19,8 @@ const Memo = (props) => {
<TextArea
className="form-control seed-text-field"
error={props.input.error}
name="Memo"
placeholder="Enter Memo"
name="Note"
placeholder="Enter Note"
required={true}
rows={3}
value={props.input.value}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Wallet/Proposals/Modal/Vote.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as PropTypes from 'prop-types';
import { ValidateMemo, ValidatePassword } from './_validation';
import { ValidateMemo } from '../../../common/_validation';
import { connect } from 'react-redux';
import { txVote } from '../../../../actions/transactions/vote';
import Button from '../../../../components/Button';
Expand Down
12 changes: 0 additions & 12 deletions src/containers/Wallet/Proposals/Modal/_validation.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/containers/Wallet/Proposals/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Modal = ({
<div className="form-group">
<Label
className=""
label="Memo"
label="Note"
/>
<Memo/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Wallet/Send/Modal/Memo.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const Memo = (props) => {
<TextArea
className="form-control seed-text-field"
error={props.input.error}
name="Memo"
placeholder="Enter Memo"
name="Note"
placeholder="Enter Note"
required={true}
rows={3}
value={props.input.value}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Wallet/Send/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const Modal = ({
<div className="form-group">
<Label
className=""
label="Memo"
label="Note"
/>
<Memo/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Wallet/Validators/ModalDelegate/Memo.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const Memo = (props) => {
<TextArea
className="form-control seed-text-field"
error={props.input.error}
name="Memo"
placeholder="Enter Memo"
name="Note"
placeholder="Enter Note"
required={true}
rows={3}
value={props.input.value}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Wallet/Validators/ModalDelegate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ModalDelegate = (props) => {
<div className="form-group">
<Label
className=""
label="Memo"
label="Note"
/>
<Memo/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Wallet/Validators/ModalRedelegate/Memo.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const Memo = (props) => {
<TextArea
className="form-control seed-text-field"
error={props.input.error}
name="Memo"
placeholder="Enter Memo"
name="Note"
placeholder="Enter Note"
required={true}
rows={3}
value={props.input.value}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Wallet/Validators/ModalRedelegate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ModalRedelegate = (props) => {
<div className="form-group">
<Label
className=""
label="Memo"
label="Note"
/>
<Memo/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Wallet/Validators/ModalUnbond/Memo.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const Memo = (props) => {
<TextArea
className="form-control seed-text-field"
error={props.input.error}
name="Memo"
placeholder="Enter Memo"
name="Note"
placeholder="Enter Note"
required={true}
rows={3}
value={props.input.value}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Wallet/Validators/ModalUnbond/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const ModalUnbond = (props) => {
<div className="form-group">
<Label
className=""
label="Memo"
label="Note"
/>
<Memo/>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/containers/Wallet/WithdrawRewards/Modal/Memo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as PropTypes from 'prop-types';
import { ValidateMemo } from './_validation';
import { ValidateMemo } from '../../../common/_validation';
import { connect } from 'react-redux';
import { setTxWithdrawMemo } from '../../../../actions/transactions/withdraw';
import React from 'react';
Expand All @@ -19,8 +19,8 @@ const Memo = (props) => {
<TextArea
className="form-control seed-text-field"
error={props.input.error}
name="Memo"
placeholder="Enter Memo"
name="Note"
placeholder="Enter Note"
required={true}
rows={3}
value={props.input.value}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Wallet/WithdrawRewards/Modal/Withdraw.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as PropTypes from 'prop-types';
import { ValidateMemo, ValidatePassword } from './_validation';
import { ValidateMemo, ValidatePassword } from '../../../common/_validation';
import { connect } from 'react-redux';
import { txWithdraw } from '../../../../actions/transactions/withdraw';
import Button from '../../../../components/Button';
Expand Down
12 changes: 0 additions & 12 deletions src/containers/Wallet/WithdrawRewards/Modal/_validation.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/containers/Wallet/WithdrawRewards/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Modal = (props) => {
<div className="form-group">
<Label
className=""
label="Memo"
label="Note"
/>
<Memo/>
</div>
Expand Down
8 changes: 8 additions & 0 deletions src/containers/common/_validation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
const bip39 = require('bip39');

export const ValidateMemo = (value) => {
if (bip39.validateMnemonic(value.trim())) {
return new Error(
'This looks like a mnemonic. Please do not attach the mnemonic ' +
'or other sensitive data to note, as it is public and can be seen by anyone.');
}

return new Error('');
};

Expand Down
Loading

0 comments on commit a0661a9

Please sign in to comment.