Commit d14b306985ee0da43b2f75b293e235c1d6636472

Authored by Victor Costa
1 parent f64d7f33

Js login

plugins/oauth_client/lib/oauth_client_plugin.rb
... ... @@ -29,6 +29,14 @@ class OauthClientPlugin < Noosfero::Plugin
29 29 end
30 30 end
31 31  
  32 + def body_ending
  33 + "<script>oauthPluginCloseLoginPopup(#{logged_in?});</script>"
  34 + end
  35 +
  36 + def js_files
  37 + 'main.js'
  38 + end
  39 +
32 40 PROVIDERS = {
33 41 :facebook => {
34 42 :name => 'Facebook'
... ...
plugins/oauth_client/public/main.js 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +function oauthPluginCloseLoginPopup(loggedIn) {
  2 + if (window.opener && typeof window.opener.handleLoginResult == 'function') {
  3 + try {
  4 + window.opener.handleLoginResult(loggedIn);
  5 + } catch (err) {}
  6 + window.close();
  7 + }
  8 + return false;
  9 +}
... ...