We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37059
    • 368 Posts
    I have an apparent issue with activation email links on Register, and this issue is of the most difficult variety - it is one I cannot replicate myself.

    I have a standard Register/Login setup where people can create an account, then click an authentication link in their email to activate it so they can log in. I've run through this process several times myself with no problem. However, I have had a couple of users contact me stating that they got "Page Not Found" when they clicked the activation link, and when I checked I found that their accounts had not been activated.

    Does anyone have any guess to offer as to why this might be happening on some registrations but not others?
      Jason
      • 9995
      • 1,613 Posts
      I had something similar, i think it had to do with admin being loggen in?!
      Because lately i was testing, after making a testaccount i got email, clicked it, then came onto a page where i should be redirected to an protected page (group) which i should be able to see, but i had no access, came onto a page not found/no permission page too.

      After logging out as admin i was able to login with the account i made and did get onto the protected page.

      My code
      [[!ConfirmRegister? &redirectTo=`10`]]


      The activation did always work i think, so it's not the same problem u have.

      Pritty weird, did u compare the users?
        Evolution user, I like the back-end speed and simplicity smiley
        • 3749
        • 24,544 Posts
        Is there anything in the MODX Error Log for the times when they tried to register?

        You might also try installing the LogPageNotFound extra to see if it will tell you anything about the URL the registration email was sending them to.


        ---------------------------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
        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
          • 37059
          • 368 Posts
          Sorry for the long delay; I've been busy with other stuff but I'm back on this now.

          Quote from: fourroses666 at Mar 19, 2012, 11:15 PM

          Pritty weird, did u compare the users?
          In what way?

          @BobRay -
          There is a ton of stuff in the error log - nothing I can find corresponding exactly to the dates and times in question, but some close enough they might have something to do with it. This particular error comes up over and over again:

          [2012-02-04 04:22:23] (ERROR @ /index.php) modUserProfile: Attempt to set NOT NULL field internalKey to NULL


          What do you make of that?

          Here's my Register snippet call:

          [[!Register?
              &submitVar=`registerbtn`
              &usernameField=`email`
              &validate=`
              	nospam:blank,
              	email:required:email,
              	password:required:minLength=^6^,
              	password_confirm:password_confirm=^password^,
              	fullname:required`
              &placeholderPrefix=`reg.`
              &persistParams=`1`
          &activationEmailSubject=`Activate your Registration`
          &usergroups=`4`
          &successMsg=`Your information was successfully submitted.  Please check your email for the activation link.`
          &activationResourceId=`201`
          ]]
          


          And my ConfirmRegister call on Resource 201:

          [[!ConfirmRegister?
          &redirectTo=`194`]]
          


          I am running MODx 2.2.0-pl2 with the latest version of Register.
            Jason
            • 37059
            • 368 Posts
            Oh, also, I did just install LogPageNotFound - thanks Bob for the suggestion as well as for developing the addon. I'll be monitoring that and report here if it sheds any light on the situation.
              Jason
              • 3749
              • 24,544 Posts
              I think I know what's happening. The link in the register email is only good for a limited time. The default is 180 min. (three hours). Any user who tries the link after the time is up gets the error page.

              You can make it longer by setting this property in the register tag (the unit is minutes):

              &activationttl=`1440`




              ------------------------------------------------------------------------------------------
              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
                • 37059
                • 368 Posts
                Quote from: BobRay at Apr 07, 2012, 05:37 PM
                I think I know what's happening. The link in the register email is only good for a limited time. The default is 180 min. (three hours). Any user who tries the link after the time is up gets the error page.

                You can make it longer by setting this property in the register tag (the unit is minutes):

                &activationttl=`1440`


                Sly! Thanks so much, Bob. I'm hopeful that this could be the explanation. One of my complaints is indeed dated more than 3 hours after the activation email was sent. Another isn't, but that could have been user error of some kind. I'll post back to this thread if there is any further trouble.
                  Jason
                  • 37059
                  • 368 Posts
                  There was any further trouble sad

                  At last post I changed the TTL to 4320 minutes - three days. I got no further complaints, until this morning. A user registered an account at 9:25, and clicked through to the confirm registration page at 9:27. Page not found on the first attempt. My stats logger and LogPageNotFound confirm it.

                  I am now very sad. Any help would be appreciated.
                    Jason
                    • 3749
                    • 24,544 Posts
                    Is the page they are being sent to protected in any way?

                    There's a bug in the login snippet that logs users in from the register email as (anonymous) instead of who they really are.

                    I think you can see the fix here: https://github.com/splittingred/Login/pull/53/files


                    If that's not it. I'm stumped.


                    ------------------------------------------------------------------------------------------
                    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
                      • 37059
                      • 368 Posts
                      Quote from: BobRay at May 03, 2012, 11:05 PM
                      Is the page they are being sent to protected in any way?
                      The confirm-register page or the redirectTo page?
                        Jason