We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28215
    • 4,149 Posts
    This is an auto-generated topic for Login 1.5.2-rc1 by splittingred.

    Brief Description:

    Loads a simple login/logout form, with password retrieval functionality and a register form snippet.
    New in 1.5.2

    • [li]Ensure preHooks run before password validation in ChangePassword snippet
    • Fix issue with placeholderPrefix in UpdateProfile snippet
    • [/li]

    New in 1.5.1

    • [#44] Fix bug with login validator, &validate parameter
    • [#40] Fix issue with syncUsername in UpdateProfile
    • [#42] Respect allow_multiple_emails setting that prevents users with same email addresses
    • [#43] Add workaround for xPDO bug with NULL fields in modUserProfile
    • Add &validate ability to Register/UpdateProfile snippets
    • Enhance Validators in Register/UpdateProfile to FormIt-standards
    • Trim each hook specification in hooks calls
    • [#28] Fixed validator issue in UpdateProfile
    • Added redirectTo and redirectParams on ForgotPassword snippet
    • Updated events in ResetPassword snippet to pass user object
    • Fixed UpdateProfile to properly update user obj so derivative User classes can manage profile updates


    See the Official Documentation here:
    http://rftm.modx.com/display/ADDON/Login
    See bugs here:
    http://bugs.modx.com/projects/Login
      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • 6902
      • 126 Posts
      I am just trying to create a post-hook snippet for Login.Register that also adds users to the Discuss table (to prevent weirdness/errors with Discuss and allow for one login page with custom fields)... but I’m not sure how or if you can get the ID of the newly-created user in the post-hook call for Login.Register. Hopefully this is a ridiculously simple question to answer, but I can’t seem to find this info anywhere...
        • 28215
        • 4,149 Posts
        $user =& $hook->getValue('register.user');
        $id = $user->get('id');


        Should work.
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 18609
          • 1 Posts
          If I specified minLength or required for a field and just fill it up with spaces, the standard validator lets it through. Quite bad, but easy to fix! wink

          Just change the line in the Register snippet:

          $fields[$k] = str_replace(array(’[’,’]’),array(’[’,’]’),$v);

          and add a trim for the next release:

          $fields[$k] = trim(str_replace(array(’[’,’]’),array(’[’,’]’),$v));

          Feature Request:
          How about supporting your great automatic validation for checkboxes and option buttons and support remembering values for those field types?

          Keep up the good work!


            • 6902
            • 126 Posts
            Quote from: MathiasW at Jan 05, 2011, 05:22 PM

            Feature Request:
            How about supporting your great automatic validation for checkboxes and option buttons and support remembering values for those field types?

            What about something like this?

            <input type="radio" name="radioButton" value="123"  [[+radioButton:if=`[[+radioButton]]`:is=`123`:then=`checked="checked"`]] />
            
              • 28215
              • 4,149 Posts
              Quote from: debussy at Jan 05, 2011, 07:20 PM

              Quote from: MathiasW at Jan 05, 2011, 05:22 PM

              Feature Request:
              How about supporting your great automatic validation for checkboxes and option buttons and support remembering values for those field types?

              What about something like this?

              <input type="radio" name="radioButton" value="123"  [[+radioButton:if=`[[+radioButton]]`:is=`123`:then=`checked="checked"`]] />
              


              Already in FormIt: http://rtfm.modx.com/display/ADDON/FormIt.Handling+Selects,+Checkboxes+and+Radios

              (they will work for Login as well)
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 6902
                • 126 Posts
                Quote from: splittingred at Jan 05, 2011, 03:43 PM

                $user =& $hook->getValue('register.user');
                $id = $user->get('id');


                Should work.

                Thank you... I got it working, but it was a big scary nightmare! That’s what I get with messing with alpha software I guess. Plus, most of the xPDO stuff still makes my head swim.


                For the curios:

                This is what my postHook snippet ended up looking like:

                <?php
                
                $user =& $hook->getValue('register.user');
                $id = $user->get('id');
                
                require_once $modx->getOption('discuss.core_path').'model/discuss/discuss.class.php';
                $discuss = new Discuss($modx,$scriptProperties);
                $discuss->initialize($modx->context->get('key'));
                $modx->lexicon->load('discuss:user');
                
                // create Discuss User Profile
                $profile = $modx->newObject('disUserProfile');
                $profile->set('user',$id);
                $profile->set('createdon',strftime('%Y-%m-%d %H:%M:%S'));
                $profile->set('ip',$_SERVER['REMOTE_ADDR']);
                $profile->set('last_login',strftime('%Y-%m-%d %H:%M:%S'));
                $profile->set('status',disUserProfile::UNCONFIRMED);
                $profile->set('last_active',strftime('%Y-%m-%d %H:%M:%S'));
                $profile->set('show_email', '');
                $profile->save();
                
                return true;
                


                With this, I kept getting a "Fatal error: Call to a member function set() on a non-object." The error was generated by the Discuss class itself at line 167: "$activity->set(’day’,$now);" (in the _initSession function).

                Long story short, I randomly and desperately placed the main Discuss snippet call [[!Discuss]] at the top of the page just above the FormIt call and it all started working. I don’t know why or how huh, but at 2am I just want to be done! tongue

                  • 6902
                  • 126 Posts
                  When it comes to the registration confirmation, things seem... broken. They aren’t, but that’s how they seem. Let me give some scenarios:

                  Example 1:

                  • User Registers & gets confirmation email
                  • clicks link in email and lands on confirmation page w/ success message
                  • user goes to login page and logs in
                  • login page set to redirect to previous page, sends user back to confirmation page
                  • user already registered: confirmation page bounces user to error page (client freaks out)

                  Example 2:

                  • User Registers & gets confirmation email
                  • clicks link in email and lands on confirmation page w/ success message
                  • user goes to login page and logs in
                  • login page redirects to some other page
                  • user browses site
                  • user navigates browser history or uses back button and gets to confirmation page
                  • user already registered: confirmation page bounces user to error page (client freaks out)

                  Example 3:

                  • User already registered, and clicks link confirmation email again later (as shortcut to get to site)
                  • user already registered: confirmation page bounces user to error page (client freaks out)

                  In other words, I think the confirmation Snippet should be a little more robust in how it handles confirmation. If it is an active user that is already confirmed, just returning empty would be preferable to the error page. Or maybe some template or string options on what to display depending on the status, i.e., [[!ConfirmRegister? &successMssg=`Thanks for Registering` &existsMssg=`Your account has already been activated` &failRedirect=`123`]]

                  My apologies if this is just a misconfiguration on my part.
                    • 28215
                    • 4,149 Posts
                    Can you file that here, Paul?

                    http://bugs.modx.com/projects/login/issues

                    Thanks for reporting it.
                      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                      • 6902
                      • 126 Posts
                      I had trouble getting my account to work (which is why I didn’t do it sooner), but I got it working. On a related note, is there some way to change my password?

                      Anyway, it’s been filed. Thanks!