Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 26th, 2012  |  syntax: JavaScript  |  size: 1.04 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function browserid_login() {
  2.         navigator.id.getVerifiedEmail(function(assertion) {
  3.                 if (assertion) {
  4.                         var rememberme = document.getElementById('rememberme');  // I added a var here
  5.                         if (rememberme != null)
  6.                                 rememberme = rememberme.checked;
  7.                         var form = document.createElement('form');
  8.                         form.setAttribute('style','display: none;'); //Style fix
  9.                         form.method = "POST";
  10.                         form.action = browserid_siteurl;        // I removed the id as it is not used
  11.                         var fields = [{name: "browserid_assertion", value: assertion},
  12.                                 {name: "rememberme", value: rememberme}];
  13.                         if (browserid_redirect != null){
  14.                         fields.push({name: "redirect_to", value: browserid_redirect});
  15.                         }
  16.                         for (var i = 0, length = fields.length; i < length; i++){
  17.                                 var field = document.createElement('input');
  18.                                 field.type = "hidden";
  19.                                 field.name = fields[i].name;
  20.                                 field.value = fields[i].value;
  21.                                 form.appendChild(field);
  22.                         }
  23.                         var my_form = document.body.appendChild(form);
  24.                         my_form.submit();
  25.                 }
  26.                 else
  27.                         alert(browserid_failed);
  28.         });
  29.         return false;
  30. }