forked from meteor/meteor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathend_of_popup_response.html
51 lines (43 loc) · 1.35 KB
/
end_of_popup_response.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<html>
<head>
<script type="text/javascript">
function storeAndClose() {
var config = JSON.parse(document.getElementById("config").innerHTML);
if (config.setCredentialToken) {
var credentialToken = config.credentialToken;
var credentialSecret = config.credentialSecret;
if (config.isCordova) {
var credentialString = JSON.stringify({
credentialToken: credentialToken,
credentialSecret: credentialSecret
});
window.location.hash = credentialString;
}
if (window.opener && window.opener.Package &&
window.opener.Package.oauth) {
window.opener.Package.oauth.OAuth._handleCredentialSecret(
credentialToken, credentialSecret);
} else {
try {
localStorage[config.storagePrefix + credentialToken] = credentialSecret;
} catch (err) {
// We can't do much else, but at least close the popup instead
// of having it hang around on a blank page.
}
}
}
if (! config.isCordova) {
document.getElementById("completedText").style.display = "block";
window.close();
}
}
</script>
</head>
<body onload="storeAndClose()">
<p id="completedText" style="display:none;">
Login completed. <a href="#" onclick="window.close()">
Click here</a> to close this window.
</p>
<div id="config" style="display:none;">##CONFIG##</div>
</body>
</html>