Verify origin and type of postMessage in select-dialog

This commit is contained in:
Michael Thomas 2022-01-19 21:10:15 -05:00
parent 22a0fad4dd
commit 9268d3880f
2 changed files with 5 additions and 4 deletions

View File

@ -32,9 +32,10 @@ class SelectDialog extends React.Component<DialogProps, DialogState> {
}
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.setState({ isOpen: false });
this.setState({ isOpen: false }); // Close Dialog
}
}
render() {

View File

@ -1 +1 @@
export const baseUrl: string = '//forms.cognito.test';
export const baseUrl: string = 'https://forms.cognito.test';