{"size": 1072, "ext": "js", "max_stars_repo_path": "node/public/javascripts/social_login.js", "max_stars_repo_name": "WikiSocium/WikiSocium", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node/public/javascripts/social_login.js", "max_issues_repo_name": "WikiSocium/WikiSocium", "max_issues_repo_issues_event_min_datetime": "2019-12-11T19:41:53.000Z", "max_issues_repo_issues_event_max_datetime": "2019-12-11T20:15:41.000Z", "max_forks_repo_path": "node/public/javascripts/social_login.js", "max_forks_repo_name": "WikiSocium/WikiSocium", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 28.972972973, "max_line_length": 75, "alphanum_fraction": 0.661380597}
function ReturnOnSuccessLogin( uid, social_name ) {
  var form = document.createElement("form");
  form.setAttribute("method", "post");
  form.setAttribute("action", "/sessions/");      
  form.setAttribute("id", social_name+"_auth_form");

  var params = new Array();
  params['user['+social_name+'_uid]'] = uid;
  params['social_name'] = social_name;

  for (var key in params) {
    var hiddenField = document.createElement("input");
    hiddenField.setAttribute("type", "hidden");
    hiddenField.setAttribute("name", key);
    hiddenField.setAttribute("value", params[key]);
    form.appendChild(hiddenField);
  }

  window.opener.document.body.appendChild(form);
  window.opener.document.getElementById(social_name+"_auth_form").submit();
  self.close();
}

function LoginInternally(social_name, uid, callback) {
  $.ajax(
  {
    url: '/social/login',
    type: 'POST',
    data: 'social_name=' + social_name + '&uid=' + uid,
    success: function(res) {
      callback(res);
    },
    error: function(jqXHR, textStatus, errorThrown) {
      // To do
    }
  });
}