Search code examples
javascriptautologinsharethis

Why in the World is the UserName/Login Field Filling with Random String of Numbers and Letters?


The username/login field autofills with numbers and letters - I have checked the JavaCode, hunted the web for others experiencing the same problem but found nothing.

http://scottjaxon.com/gotchalegaldev/

sample of generated string (and I'm not trying to generate anything in the login field) ab722fa-134c68dddcf-7d431b6-82

7639673-135df770710-11a7fb05-70

Is this coming from a conflict with the ShareThis Javascript? Or is this a serverside error conflicting with AutoLogin.aspx?

any hints, tips or solutions are very much appreciated

SJ


Solution

  • Here's the problem:

    • There's a cookie called "__unam" being set by ShareThis.com.

    • In the pageLoad() function in global.js, you're looking for a cookie called "un" and using it to preset the username field.

    • Your cookie parsing function (getCookie(), also in global.js) is poorly written - it just checks whether the name of the desired cookie is found within the name of each cookie in document.cookie, rather than equal to:

      if (key.indexOf(idStr.toLowerCase()) >= 0)
      

    So getCookie("un") matches the __unam cookie, gets that cookie's value (which happens to be some sort of hash string), and then inserts it into the username field.