master
Steve L. Nyemba 7 years ago
parent 8e62b8db6e
commit 84ac231655

@ -19,18 +19,23 @@ jx.cloudview.oauth.init = function (id, key,callback,err) {
url = url.replace(/:protocol/,jx.cloudview.protocol).replace(/:host/,jx.cloudview.host)
var httpclient = HttpClient.instance()
httpclient.setHeader("platform",navigator.appName)
httpclient.post(url, function (x) {
var url = x.responseText
var oauth_uri = url.match(/redirect_uri=(.+)&/)[1];
url = url.replace(oauth_uri, key)
try{
httpclient.post(url, function (x) {
jx.cloudview.handler = null
jx.cloudview.popup = window.open(url, 'oauth', 'width=405, height=900')
jx.cloudview.oauth.listen(key,callback,err)
})
var url = x.responseText
alert(x.status)
var oauth_uri = url.match(/redirect_uri=(.+)&/)[1];
url = url.replace(oauth_uri, key)
jx.cloudview.handler = null
jx.cloudview.popup = window.open(url, 'oauth', 'width=405, height=900')
jx.cloudview.oauth.listen(key,callback,err)
})
}catch(error){
err()
}
}
/**
@ -67,17 +72,19 @@ jx.cloudview.oauth.listen = function (key,callback,err) {
}
//
// Until the control is returned an exception will be generated
// So the popup.close will never be executed ...
// So the popup.close will never be executed ...
jx.cloudview.popup.close()
} catch (error) {
//
// If the window was closed chances are the user closed the window without loging in
if(jx.cloudview.popup.closed){
clearInterval(jx.cloudview.handler)
if (err != null){
err()
}
if(jx.cloudview.popup != null){
if(jx.cloudview.popup.closed){
clearInterval(jx.cloudview.handler)
if (err != null){
err()
}
}
}
console.log([jx.cloudview.popup.closed,error])
}

Loading…
Cancel
Save