|
|
@ -19,10 +19,12 @@ jx.cloudview.oauth.init = function (id, key,callback,err) {
|
|
|
|
url = url.replace(/:protocol/,jx.cloudview.protocol).replace(/:host/,jx.cloudview.host)
|
|
|
|
url = url.replace(/:protocol/,jx.cloudview.protocol).replace(/:host/,jx.cloudview.host)
|
|
|
|
var httpclient = HttpClient.instance()
|
|
|
|
var httpclient = HttpClient.instance()
|
|
|
|
httpclient.setHeader("platform",navigator.appName)
|
|
|
|
httpclient.setHeader("platform",navigator.appName)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
httpclient.post(url, function (x) {
|
|
|
|
httpclient.post(url, function (x) {
|
|
|
|
|
|
|
|
|
|
|
|
var url = x.responseText
|
|
|
|
var url = x.responseText
|
|
|
|
|
|
|
|
alert(x.status)
|
|
|
|
var oauth_uri = url.match(/redirect_uri=(.+)&/)[1];
|
|
|
|
var oauth_uri = url.match(/redirect_uri=(.+)&/)[1];
|
|
|
|
|
|
|
|
|
|
|
|
url = url.replace(oauth_uri, key)
|
|
|
|
url = url.replace(oauth_uri, key)
|
|
|
@ -31,6 +33,9 @@ jx.cloudview.oauth.init = function (id, key,callback,err) {
|
|
|
|
jx.cloudview.popup = window.open(url, 'oauth', 'width=405, height=900')
|
|
|
|
jx.cloudview.popup = window.open(url, 'oauth', 'width=405, height=900')
|
|
|
|
jx.cloudview.oauth.listen(key,callback,err)
|
|
|
|
jx.cloudview.oauth.listen(key,callback,err)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
}catch(error){
|
|
|
|
|
|
|
|
err()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -72,6 +77,7 @@ jx.cloudview.oauth.listen = function (key,callback,err) {
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// If the window was closed chances are the user closed the window without loging in
|
|
|
|
// If the window was closed chances are the user closed the window without loging in
|
|
|
|
|
|
|
|
if(jx.cloudview.popup != null){
|
|
|
|
if(jx.cloudview.popup.closed){
|
|
|
|
if(jx.cloudview.popup.closed){
|
|
|
|
clearInterval(jx.cloudview.handler)
|
|
|
|
clearInterval(jx.cloudview.handler)
|
|
|
|
if (err != null){
|
|
|
|
if (err != null){
|
|
|
@ -79,6 +85,7 @@ jx.cloudview.oauth.listen = function (key,callback,err) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
console.log([jx.cloudview.popup.closed,error])
|
|
|
|
console.log([jx.cloudview.popup.closed,error])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},1500)
|
|
|
|
},1500)
|
|
|
|