We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37393
    • 68 Posts
    Hi,

    Could anyone tell me how the process works when you reset a forgotten password?

    How do i use this generated password within a plugin to insert it into another table within the same db?

    $password = $this->login->generatePassword();


    Do i place a $_GET['password'] within my plugin or what?

    public function sendPasswordResetEmail() {
            $fields = $this->dictionary->toArray();
    
            /* generate a password and encode it and the username into the url */
            $password = $this->login->generatePassword();
            $confirmParams = array(
                'lp' => urlencode(base64_encode($password)),
                'lu' => urlencode(base64_encode($fields['username']))
            );
            $confirmUrl = $this->modx->makeUrl($this->getProperty('resetResourceId',1),'',$confirmParams,'full');
    


    Any help or advice are welcome and appreciated,
    Thanks!
      IntoVPS - VPS hosting service with super-fast response.
      If MODx does not suit your needs then you have a lack of imagination.
      • 3749
      • 24,544 Posts
      It may be available in the $_GET array, but I think you might also be able to get it with this:

      $modx->cacheManager->get('login/resetpassword/'.$username);



      You probably know this already, but just in case -- I hope you're not planning to store user passwords in plain text in the DB. That would be a huge breach of standard security practices and user expectations. You should always store a password hash rather than the actual password.





      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        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
        • 37393
        • 68 Posts
        Quote from: BobRay at Jul 08, 2012, 03:23 PM
        It may be available in the $_GET array, but I think you might also be able to get it with this:

        $modx->cacheManager->get('login/resetpassword/'.$username);



        You probably know this already, but just in case -- I hope you're not planning to store user passwords in plain text in the DB. That would be a huge breach of standard security practices and user expectations. You should always store a password hash rather than the actual password.





        ------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using.
        MODX info for everyone: http://bobsguides.com/modx.html

        Edit: Almost done with this, I figured out pretty soon that it was the base64_decode which made the trick, now I'm onto getting the correct user id from the table. [ed. note: bowkilled last edited this post 14 years, 2 months ago.]
          IntoVPS - VPS hosting service with super-fast response.
          If MODx does not suit your needs then you have a lack of imagination.
          • 37393
          • 68 Posts
          Nevermind, i got the whole function working.

          The solution was: Hacking wink

          Yes i know, don't remind me. However, I do always save my precious work once finished.
            IntoVPS - VPS hosting service with super-fast response.
            If MODx does not suit your needs then you have a lack of imagination.