We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24719
    • 194 Posts
    hi everyone, great work on modx.

    i’ve been looking at the ManagerLogin snippet, and there doesn’t appear to be any validation of the parameters it receives. however, it uses invokeEvent to invoke the onBeforeManagerLogin event.

    i haven’t been able to find much documentation for events. am i right in thinking that invoking events just gives modx a chance to insert other program code into the flow, before returning to where the call came from, but that it wouldn’t be able to modify the variables from the calling function? specifically, i’m wondering if when ManagerLogin invokes onBeforeManagerLogin, it somehow receives back sanitised values for $username and $password, or should it still be performing its own validation?

    thanks in advance
    redman
      • 27376
      • 576 Posts
      Have you looked at when the ’OnManagerAuthentication’ event is called?
        • 24719
        • 194 Posts
        hi sirlancelot,

        that event is invoked, but i can’t see where it goes. a value is returned after it has been invoked, so it’s obviously going somewhere. how would i find out which function gets called onManagerAuthentication? this event isn’t even in the modx_system_eventnames table...
          • 27376
          • 576 Posts
          ’OnManagerAuthentication’ is invoked so that plugins can do custom authentication (via LDAP, or something else). So you would create a new plugin, put your authentication code in there, and check the ’OnManagerAuthentication’ box in the "System Events" tab.

          The default installation has no OnManagerAuthentication Overrides, so false is returned, then MODx kicks in to local authentication via it’s own user tables.

          So if you create a plugin that returns true to OnManagerAuthentication, you are allowing that user to login.

          EDIT: I am working on documenting all the MODx system events, you can take a look here, I currently don’t have any info on the ’OnManagerAuthentication’ event, but this post is a good start if you wanna help out wink
            • 24719
            • 194 Posts
            cool, thanks for that. good work on documenting the api. if i get chance i’ll add to the wiki too as i explore modx.