Verify origin and type of postMessage in select-dialog
This commit is contained in:
parent
22a0fad4dd
commit
9268d3880f
|
@ -32,9 +32,10 @@ class SelectDialog extends React.Component<DialogProps, DialogState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePostMessage = ( event: MessageEvent ) => {
|
handlePostMessage = ( event: MessageEvent ) => {
|
||||||
console.log( 'PostMessage recieved:', event.data );
|
if (event.origin === baseUrl && event.data.type === 'cog-form-selected') {
|
||||||
this.props.onSelectForm( event.data );
|
this.props.onSelectForm( event.data );
|
||||||
this.setState({ isOpen: false });
|
this.setState({ isOpen: false }); // Close Dialog
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export const baseUrl: string = '//forms.cognito.test';
|
export const baseUrl: string = 'https://forms.cognito.test';
|
||||||
|
|
Loading…
Reference in New Issue