MEW-01-003 - Parse JSON pasted into signed message verifier (#979)
This commit is contained in:
parent
0d768d7517
commit
e34137270e
|
@ -50,6 +50,7 @@ export class VerifyMessage extends Component<Props, State> {
|
|||
placeholder={signaturePlaceholder}
|
||||
value={signature}
|
||||
onChange={this.handleSignatureChange}
|
||||
onPaste={this.handleSignaturePaste}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -103,6 +104,19 @@ export class VerifyMessage extends Component<Props, State> {
|
|||
const signature = e.currentTarget.value;
|
||||
this.setState({ signature });
|
||||
};
|
||||
|
||||
private handleSignaturePaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
||||
const text = e.clipboardData.getData('Text');
|
||||
if (text) {
|
||||
try {
|
||||
const signature = JSON.stringify(JSON.parse(text), null, 2);
|
||||
this.setState({ signature });
|
||||
e.preventDefault();
|
||||
} catch (err) {
|
||||
// Do nothing, it wasn't json they pasted
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(null, {
|
||||
|
|
Loading…
Reference in New Issue