We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14281
    • 120 Posts
    I’m not sure if this is the appropriate place to put this. I think this is a bug, but I need immediate attention for it, if possible.

    I just upgraded one of my sites from 0.9.5 r1533 to r1785. After doing so, some strange characters are being placed in the value parameter of the username field in the login form on the front end (okay, I win the most prepositions ever used deliberately contest). My username is jlivingston. When I go to login, the username field is already filled in with these symbols: ­Ã?=kñ£ß (I’m not even sure that will post into the forum accurately). At first, I thought it was some strangeness with my browser placing something from it’s form field cache. Then I looked at the html source of the page, and these symbols are actually in the value field, meaning that this came from MODx.

    I think it has something to do with encryption using the rc4crypt object. This was working fine until the upgrade.

    I’d be glad to post this in the bug tracker as well, if needed.

    Thanks.
      • 25663 MODX Staff
      • 12,272 Posts
      I believe Jason (opengeek) had something exactly like this happen ... I’ll let him comment and alert him to this thread.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 4295
        • 98 Posts
        Was there ever a fix for this problem? I updated my development site to utf8 and have everything working fine with the exception of when I check the "remember me" in the login box, then I get username gibberish from some type of encoding problem like jlivingston. Has anyone found the cure? Thanks.
          • 22303 MODX Staff
          • 10,725 Posts
          It appears the cookie-related code for web login is setting the username to the value of the cookieKey for some unknown reason (sigh). And after some further investigation, it appears that the rememberme code and cookie that one would think could keep an existing server-side session alive, is actually doing nothing but setting an extra cookie. The quick fix is available by editing the following files to remove the cookie code...

          Add the comments to assets/snippets/weblogin/weblogin.inc.php, lines 17 through 26, with the exception of line 25, as shown here:
          //    if(isset($_COOKIE[$cookieKey])) {
          //        $cookieSet = 1;
          //        $sitename = $_COOKIE[$cookieKey];
          //        $thepasswd = substr($site_id,-5)."crypto"; // create a password based on site id
          //        $rc4 = new rc4crypt;
          //        $thestring = $rc4->endecrypt($thepasswd,$sitename,'de');
          //        $uid = $thestring;
          //    }else{
                  $uid = isset($_POST['username'])? $_POST['username']:'';
          //    }


          Also, add comments to lines 354 through 362 of assets/snippets/weblogin/weblogin.processor.inc.php:
          //    if($_POST['rememberme']==1) {
          //        $username = $_POST['username'];
          //        $thepasswd = substr($site_id,-5)."crypto"; // create a password based on site id
          //        $rc4 = new rc4crypt;
          //        $thestring = $rc4->endecrypt($thepasswd,$username);
          //        setcookie($cookieKey, $thestring,time()+604800, "/", "", 0);
          //    } else {
          //        setcookie($cookieKey, "",time()-604800, "/", "", 0);
          //    }


          Note however that this completely invalidates the usefulness of the rememberme checkbox, but, alas, it was doing nothing anyway. I’m going to try and address this with a proper cookie-based session solution as soon as possible, before delivering 0.9.5 final.
            • 4295
            • 98 Posts
            Thanks for the explanation, Jason. Much appreciated.