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) 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)
httpclient.post(url, function (x) {
var url = x.responseText try{
httpclient.post(url, function (x) {
var oauth_uri = url.match(/redirect_uri=(.+)&/)[1]; var url = x.responseText
alert(x.status)
var oauth_uri = url.match(/redirect_uri=(.+)&/)[1];
url = url.replace(oauth_uri, key) url = url.replace(oauth_uri, key)
jx.cloudview.handler = null jx.cloudview.handler = null
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,12 +77,14 @@ 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.closed){ if(jx.cloudview.popup != null){
clearInterval(jx.cloudview.handler) if(jx.cloudview.popup.closed){
if (err != null){ clearInterval(jx.cloudview.handler)
err() if (err != null){
} err()
}
}
} }
console.log([jx.cloudview.popup.closed,error]) console.log([jx.cloudview.popup.closed,error])
} }

Loading…
Cancel
Save