Detect blocked popups
This commit is contained in:
5
auth.php
5
auth.php
@ -94,10 +94,15 @@ function getAuthorizationCode( $url ){
|
||||
|
||||
var timer = setInterval(checkPopup, 1000);
|
||||
function checkPopup(){
|
||||
if( typeof(popup) !== 'undefined' && popup ){
|
||||
if( popup.closed ){
|
||||
window.parent.postMessage( 'closed', '*' );
|
||||
clearInterval(timer);
|
||||
}
|
||||
}else{
|
||||
window.parent.postMessage( 'blocked', '*' );
|
||||
clearInterval(timer);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@ -35,6 +35,8 @@ class SpotifyAuthenticationFrame extends React.Component{
|
||||
frameUrl: '//jamesbarnsley.co.nz/auth.php?action=frame',
|
||||
authorizing: false
|
||||
})
|
||||
}else if(event.data == 'blocked'){
|
||||
self.props.uiActions.createNotification('Popup blocked. Please allow popups and try again.','bad')
|
||||
}else{
|
||||
|
||||
// only allow incoming data from our authorized authenticator proxy
|
||||
@ -59,7 +61,6 @@ class SpotifyAuthenticationFrame extends React.Component{
|
||||
frameUrl: '//jamesbarnsley.co.nz/auth.php?action=authorize&app='+location.protocol+'//'+window.location.host,
|
||||
authorizing: true
|
||||
})
|
||||
this.props.uiActions.createNotification('No popup? Your browser may have blocked it...')
|
||||
}
|
||||
|
||||
renderAuthorizeButton(){
|
||||
|
||||
Reference in New Issue
Block a user