We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22446
    • 181 Posts
    Can anyone post how the Change password snippet is supposed to be used with the login or update profile?

    I cannot seem to find anything in the documentation about this.

    Thanks
    • Hi there, I’ve added a tutorial which includes how I used the ChangePassword snippet, you can find it on the Login - A Tutorial post.

      Hope it helps smiley
        Helen Warner
        Number one pixel!
        Proud to be linked with MODX at Crimson Pixel
        • 17750
        • 78 Posts
        Lyubomir Kolev Reply #23, 13 years ago
        Why do we need to change user’s password?

        For example - the user has forgotten their password and get it changed through the forgotten password form.
        But the user wants to have his own, easily memorable password.

        After logging the user appear two options - to update the profile fields with general information or to change the password.
        <span><a href="update-profile.html">Update Profile</a></span>
        <span style="margin-left:15px;"><a href="change-password.html">Change password</a></span>
        


        I made a new document called "change-password". ChangePassword snipet use as follows:


        [[!ChangePassword? &reloadOnSuccess=`0` &successMessage=`[[!%login.change_password? &namespace=`login` &topic=`changepassword`]] - [[!%login.profile_updated? &namespace=`login` &topic=`updateprofile`]]`]]

        <div class="change-password">
        <div style="color:#66CC00">[[+logcp.successMessage]] </div>



        <form class="form" action="[[~[[*id]]]]" method="post">
        <input type="hidden" name="nospam:blank" value="" />


        <label for="password_old">[[!%login.password_old? &namespace=`login` &topic=`changepassword`]]:
        <span class="error">[[+logcp.error.password_old]]</span>
        </label>
        <input type="password" name="password_old" id="password_old" value="[[+logcp.password_old]]" />


        <label for="password_new">[[!%login.password_new? &namespace=`login` &topic=`changepassword`]]:
        <span class="error">[[+logcp.error.password_new]]</span>
        </label>
        <input type="password" name="password_new" id="password_new" value="[[+logcp.password_new]]" />


        <label for="password_new_confirm">[[!%login.password_new_confirm? &namespace=`login` &topic=`changepassword`]]:
        <span class="error">[[+logcp.error.password_new_confirm]]</span>
        </label>
        <input type="password" name="password_new_confirm" id="password_new_confirm" value="[[+logcp.password_new_confirm]]" />




        <br class="clear" />

        <div class="form-buttons">
        <input type="submit" name="logcp-submit" value="[[!%login.change_password]]" />
        </div>
        </form>
        </div>


        If filled in correctly for the old password field and fields for a new password, then change will be successful. Otherwise you will derive the corresponding error messages.

        * I do not know why the current password field is named "old password". The password that is entered is current and not old. When I change it gets old, but is no longer current. Logically it is correct to say - current password.
          • 29444
          • 0 Posts
          The changepassword snippet does not appear to be working for new users created in revo 2.1 RC4. I would imagine this is because old and new passwords are being compared using md5 when revo 2.1 is presumably using pbkdf2. Code extract below:

          if ($validateOldPassword) {
              if (empty($fields[$fieldOldPassword]) || md5($fields[$fieldOldPassword]) != $modx->user->get('password')) {
                $errors[$fieldOldPassword] = $modx->lexicon('login.password_invalid_old');
                 }
          


          Tremendous job otherwise.
            • 35356
            • 1 Posts
            hi I’m on modx revo 2.1.1 has anyone got this to work. I would like the user to be able to change their password after resetting it.
            Thanks in Advance! smiley
              • 30319
              • 406 Posts
              DOES the ChangePassword snippet even WORK??
              putting its snippet call into a page causes a 401/503 error...!!
              thank you, smiley tom
              • It worked out-of-the-box for me, and it's the first time I've use the Login package.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 21671
                  • 244 Posts
                  I am having a devil of a time with login's bundled Change password snippet. I can't get it to display a success message after the password has been changed.

                  My snippet call is:

                  [[!ChangePassword?
                     &submitVar=`change-password`
                     &placeholderPrefix=`cp.`
                     &validateOldPassword=`1`
                     &validate=`nospam:blank`
                     &reloadOnSuccess=`0`
                     &SuccessMessage=`boo`
                     
                  ]]


                  my form is:

                  [[!+cp.successMessage:notempty=`<p style="color: red;">[[+cp.successMessage]]</p>`]]
                  <div class="updprof-error">[[!+cp.error_message]]</div>
                  <form class="form" action="[[~[[*id]]]]" method="post">
                      <input type="hidden" name="nospam" value="" />
                      <div class="ff">
                          <label for="password_old">Old Password
                              <span class="error">[[!+cp.error.password_old]]</span>
                          </label>
                          <input type="password" name="password_old" id="password_old" value="[[+cp.password_old]]" />
                      </div>
                      <div class="ff">
                          <label for="password_new">New Password
                              <span class="error">[[!+cp.error.password_new]]</span>
                          </label>
                          <input type="password" name="password_new" id="password_new" value="[[+cp.password_new]]" />
                      </div>
                      <div class="ff">
                          <label for="password_new_confirm">Confirm New Password
                              <span class="error">[[!+cp.error.password_new_confirm]]</span>
                          </label>
                          <input type="password" name="password_new_confirm" id="password_new_confirm" value="[[+cp.password_new_confirm]]" />
                      </div>
                      <div class="ff">
                          <input type="submit" class="button" name="change-password" value="Change Password" />
                      </div>
                  </form>


                  my environment is modxcloud and revo version 2.31.
                  • Quote from: noahlearner at Sep 04, 2014, 05:00 PM
                    I am having a devil of a time with login's bundled Change password snippet. I can't get it to display a success message after the password has been changed.

                    My snippet call is:

                    [[!ChangePassword?
                       &submitVar=`change-password`
                       &placeholderPrefix=`cp.`
                       &validateOldPassword=`1`
                       &validate=`nospam:blank`
                       &reloadOnSuccess=`0`
                       &SuccessMessage=`boo`   
                    ]]


                    my form is:

                    [[!+cp.successMessage:notempty=`<p style="color: red;">[[+cp.successMessage]]</p>`]]
                    ...
                    


                    @noahlearner

                    Not sure if it matters, but I noticed the case does not match in your snippet call (NOTE the CAPITAL "S"):

                    &SuccessMessage=`boo`

                      Mike Reid - www.pixelchutes.com
                      MODx Ambassador / Contributor
                      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                      ________________________________
                      Where every pixel matters.
                      • 21671
                      • 244 Posts
                      moments like these... That was the problem. Goodbye to 2 hours of my life...