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 ) => {
|
||||
console.log( 'PostMessage recieved:', event.data );
|
||||
this.props.onSelectForm( event.data );
|
||||
this.setState({ isOpen: false });
|
||||
if (event.origin === baseUrl && event.data.type === 'cog-form-selected') {
|
||||
this.props.onSelectForm( event.data );
|
||||
this.setState({ isOpen: false }); // Close Dialog
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -1 +1 @@
|
|||
export const baseUrl: string = '//forms.cognito.test';
|
||||
export const baseUrl: string = 'https://forms.cognito.test';
|
||||
|
|
Loading…
Reference in New Issue