Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
f77e7ffc
Commit
f77e7ffc
authored
8 years ago
by
Gabriel Engel
Browse files
Options
Downloads
Plain Diff
Merge pull request #3320 from ajwinter/develop
Fix CAS in Android Cordova
parents
1126ed85
ea4ff1e3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/rocketchat-cas/cas_client.js
+37
-20
37 additions, 20 deletions
packages/rocketchat-cas/cas_client.js
with
37 additions
and
20 deletions
packages/rocketchat-cas/cas_client.js
+
37
−
20
View file @
f77e7ffc
...
...
@@ -40,29 +40,46 @@ Meteor.loginWithCas = function(options, callback) {
popup_height
||
600
);
var
checkPopupOpen
=
setInterval
(
function
()
{
var
popupClosed
;
try
{
// Fix for #328 - added a second test criteria (popup.closed === undefined)
// to humour this Android quirk:
// http://code.google.com/p/android/issues/detail?id=21061
popupClosed
=
popup
.
closed
||
popup
.
closed
===
undefined
;
}
catch
(
e
)
{
// For some unknown reason, IE9 (and others?) sometimes (when
// the popup closes too quickly?) throws "SCRIPT16386: No such
// interface supported" when trying to read 'popup.closed'. Try
// again in 100ms.
return
;
}
if
(
popupClosed
)
{
clearInterval
(
checkPopupOpen
);
// Fix for #3200: monitor the popup differently if it's Cordova
if
(
Meteor
.
isCordova
)
{
// Check the URL when each page finishes loading, and if the URL contains "ticket", then close the popup because CAS has finished
popup
.
addEventListener
(
'
loadstop
'
,
function
(
e
)
{
if
(
e
.
url
.
indexOf
(
'
?ticket=
'
)
!==
-
1
)
{
popup
.
close
();
}
});
popup
.
addEventListener
(
'
exit
'
,
function
()
{
// check auth on server.
Accounts
.
callLoginMethod
({
methodArguments
:
[{
cas
:
{
credentialToken
:
credentialToken
}
}],
userCallback
:
callback
});
}
},
100
);
});
}
else
{
var
checkPopupOpen
=
setInterval
(
function
()
{
var
popupClosed
;
try
{
// Fix for #328 - added a second test criteria (popup.closed === undefined)
// to humour this Android quirk:
// http://code.google.com/p/android/issues/detail?id=21061
popupClosed
=
popup
.
closed
||
popup
.
closed
===
undefined
;
}
catch
(
e
)
{
// For some unknown reason, IE9 (and others?) sometimes (when
// the popup closes too quickly?) throws "SCRIPT16386: No such
// interface supported" when trying to read 'popup.closed'. Try
// again in 100ms.
return
;
}
if
(
popupClosed
)
{
clearInterval
(
checkPopupOpen
);
// check auth on server.
Accounts
.
callLoginMethod
({
methodArguments
:
[{
cas
:
{
credentialToken
:
credentialToken
}
}],
userCallback
:
callback
});
}
},
100
);
}
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment