Commit e189a8ad16896b7ae42622fdab25c498f40f8494
1 parent
eff12aea
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Revert "Revert "oauth_client: finish callback""
This reverts commit eff12aea9c2050f0acdcda89b10460582485be85.
Showing
1 changed file
with
4 additions
and
9 deletions
Show diff stats
plugins/oauth_client/views/oauth_client_plugin_public/finish.html.erb
| 1 | <script> | 1 | <script> |
| 2 | - function oauthPluginCloseLoginPopup(loggedIn, privateToken) { | ||
| 3 | - if (window.opener && typeof window.opener.oauthPluginHandleLoginResult == 'function') { | ||
| 4 | - try { | ||
| 5 | - window.opener.oauthPluginHandleLoginResult(loggedIn, privateToken); | ||
| 6 | - } catch (err) {} | ||
| 7 | - window.close(); | 2 | + window.addEventListener("message", function(ev) { |
| 3 | + if (ev.data.message === "requestOauthClientPluginResult") { | ||
| 4 | + ev.source.postMessage({ message: "oauthClientPluginResult", logged_in: <%= logged_in? %>, private_token: '<%= private_token %>' }, "*"); | ||
| 8 | } | 5 | } |
| 9 | - return false; | ||
| 10 | - } | ||
| 11 | - oauthPluginCloseLoginPopup(<%= logged_in? %>, '<%= private_token %>'); | 6 | + }); |
| 12 | </script> | 7 | </script> |