social_login.js

From disqus.com, 1 Month ago, written in Plain Text, viewed 3 times.
URL https://pastebin.freepbx.org/view/24f6f841 Embed
Download Paste or View Raw
  1. DISQUS.define('web.social.ui', function (window) {
  2.     var startAuth = function (service, options) {
  3.         var win = window.open(DISQUS.web.urls[service], '_blank', options);
  4.         var loc = window.location;
  5.         var origin = loc.protocol + "//" + loc.hostname + (loc.port ? ':' + loc.port : '');
  6.  
  7.         window.addEventListener('message', function (evt) {
  8.             if (evt.origin !== origin)
  9.                 return;
  10.  
  11.             var msg = JSON.parse(evt.data);
  12.             if (msg.name === '!auth:success') {
  13.                 // NOTE: Do not try to manually redirect to `next` GET argument, leave
  14.                 //       that logic to the server (by simply reloading like below) to
  15.                 //       prevent any potentially dangerous open redirect attacks.
  16.                 window.location.reload(true);
  17.             }
  18.         });
  19.     };
  20.  
  21.     $('body').delegate('.social-button.-twitter', 'click', function () {
  22.         startAuth('twitter', 'width=650,height=680');
  23.     });
  24.     $('body').delegate('.social-button.-google', 'click', function () {
  25.         startAuth('google', 'width=650,height=680');
  26.     });
  27.     $('body').delegate('.social-button.-facebook', 'click', function () {
  28.         startAuth('facebook', 'width=650,height=680');
  29.     });
  30. });
  31.  
  32.  
  33. // https://a.disquscdn.com/js/src/social_login.js

Replies to social_login.js rss

Title Name Language When
Re: social_login.js disqus.com javascript 1 Month ago.

Reply to "social_login.js"

Here you can reply to the paste above