We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10597
    • 31 Posts
    I'm having some trouble getting a properly encoded account activation link built for Login, in a custom snippet.

    I thought this should work but it does not for me.
    $confirmParams['lp'] = urlencode(base64_encode($password));
    $confirmParams['lu'] = urlencode(base64_encode($username));
    $confirmUrl = $modx->makeUrl(57,'',$confirmParams,'full');
    


    Can anyone steer me in the right direction? I've dug through all the code for Login, tried several different methods with no luck.

    Thanks
      Using ModX Revolution
      • 3749
      • 24,544 Posts
      What version of MODX? If it's Revolution, you might look at the Register snippet or the Subscribe extra, which provides a wrapper for it.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 10597
        • 31 Posts
        Bob,

        Revolution 2.3.1
        I have looked through the Register snippet code. I believe the code above works fine for the username portion. Password is what is holding it up. So there must be something else done to the password before it is encoded for the URL, that I have missed. Possibly it's using the saved encrypted password instead of raw? I am digging through it now to find the part I'm missing.

        I am building a connector for an IOS app. I have login and register worked out, a big thanks to some of your code. Just trying to get the activation part worked out.

        Thanks,

        Troy
          Using ModX Revolution
          • 10597
          • 31 Posts
          OK, so the part I was missing in my user creation function is the code below:

          	$modx->getService('registry', 'registry.modRegistry');
                  $modx->registry->addRegister('login','registry.modFileRegister');
                  $modx->registry->login->connect();
                  $modx->registry->login->subscribe('/useractivation/');
                  $modx->registry->login->send('/useractivation/',array($username => $password),array('ttl' => (180*60)));
          	$user->set('cachepwd',md5($password));
          
            Using ModX Revolution