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

    When i test the login on my site it works fine but when i click the forgotten password and the on the link contained within the password i.e. www.myWebsite.com/Page1.html?webloginmode=actp&wli=1&wlk=abYCZ67Y
    I get a message saying
    "Error while loading user account. Please contact the Site Administrator"

    I really don’t know what this could be...can anyone help at all?

    Thanks

    J
      www.9thwave.co.uk
         WEB | DESIGN | PRINT
      • 29635
      • 361 Posts
      Good timing on your post. I just ran into this a few minutes ago and after a little troubleshooting it seems like the issue is with the & as opposed to just & in the password reset email.

      You can fix this by turning off XHTML URLs in your config. Perhaps not the best solution, but it does seem to fix the issue.
        Need MODx Ecommerce? Try FoxyCart!
        • 36549
        • 572 Posts
        Hi,

        That does seeem a bit of a harsh way to resolve the issue...i wonder if there’s a way to keep th XHTML ampersand replacement on yet exclude the login reminder?

        I’m afraid i don’t know modx enough (or PHP) to start delving into this but perhaps there’s a script that can be added somewhere?

        any help appreciated.

        Thanks
          www.9thwave.co.uk
             WEB | DESIGN | PRINT
          • 36549
          • 572 Posts
          Hi,

          Further to my last post i’ve decided that turning off the XHTML urls is not the way forward as it invalidates the site.
          Does anyone know if there is a way to convert all the javascript ampersands to the validating & ?
          Or whether it’s possible to have the javascript linked from the <head> section instead of contained in the actual page?

          Thanks for any help
            www.9thwave.co.uk
               WEB | DESIGN | PRINT
            • 29635
            • 361 Posts
            Just out of curiosity, where are the validation problems coming from from turning off the XHTML option? Ditto/Reflect links?

            I don’t think a javascript solution would work (because the code itself would still be invalid even if you fix it with javascript), but I’m not sure exactly what you’re looking for. The actual &amp; versus & generation happens entirely server side and appears in the email that gets sent out on a password reset, so I’m not sure how that piece (in and of itself) would adversely effect your validation efforts.
              Need MODx Ecommerce? Try FoxyCart!
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The original WebLogin adds a block of javascript to the document head. This javascript has a couple of lines with && in it. There are two ways to fix the problem, both involve modifying the original assets/snippets/weblogin/weblogin.inc.php file (this appears to have been done in version 0.6.2).

              The simplest way is to add the CDATA tags to the javascript block around lines 31 and 75:
                  <script type="text/JavaScript">
                  <!--//--><![CDATA[//><!--
               ...
              
                  //--><!]]>
                  </script>
              

              The other way would involve breaking the javascript out to a separate file and including it in the document head, instead of having the whole block in the document head. Put the javascript in a file, and then replace the code block with
              <script type="text/javascript" src="filename.js"></script>


                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
                • 36549
                • 572 Posts
                Hi,

                I did find the previous post about Cdata tags and that has solved part of the problem...thanks.

                However that now means that the forgotten password link still doesn’t work.
                When the message gets sent to the email with XHTML urls on it looks like this:
                http://www.MyWebSite.com/Home.php?webloginmode=actp&amp;wli=1&amp;wlk=3SfaRVYX

                ...as you can see the ampersand has been replaced with the valid &amp; which causes errors with the link back to the site.
                The only way this works is with XHTML urls turned off so the link looks like this:
                http://www.MyWebSite.com/Home.php?webloginmode=actp&wli=1&wlk=3SfaRVYX

                1. Where in the files is this being generated and can it be changed?
                2. I would like to add the username after this bit of text ’You’re already logged’...what do i add ?

                Thank you for any help on this matter
                  www.9thwave.co.uk
                     WEB | DESIGN | PRINT
                  • 4041
                  • 788 Posts
                  Don’t know about q1 but for q2, look in the manager/chunks/FormLogin and find this part:
                  <!-- log out hyperlink section -->
                  <h4>You're already logged in</h4>
                  Do you wish to <a href="[+action+]" class="button">[+logouttext+]</a>?
                  <hr>


                  I think you can use [+username+] to add the name

                  There is also a logout only link in manager/chunks/WebLoginSidebar
                    xforum
                    http://frsbuilders.net (under construction) forum for evolution
                    • 36549
                    • 572 Posts
                    Thanks Breezer, i’ll give that a go.
                      www.9thwave.co.uk
                         WEB | DESIGN | PRINT
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      What you need to do is add a line to the code that creates the links for the password reminder replacing any &amp; with plain & before it gets used for the mailer; this would be after line 96 of the assets/snippets/weblogin/weblogin.processor.inc.php file:
                                  // built activation url
                                  if($_SERVER['SERVER_PORT']!='80') {
                                    $url = $modx->config['server_protocol'].'://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$modx->makeURL($modx->documentIdentifier,'',"webloginmode=actp&wli=".$row['id']."&wlk=".$newpwdkey);
                                  } else {
                                    $url = $modx->config['server_protocol'].'://'.$_SERVER['SERVER_NAME'].$modx->makeURL($modx->documentIdentifier,'',"webloginmode=actp&wli=".$row['id']."&wlk=".$newpwdkey);
                                  }
                                  // fix the XHTML query string delimiters
                                  $url = str_replace('&', '&', $url);
                      
                        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