We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42445
    • 9 Posts
    i have a site where every page contains a login form. after successful login, this form gets replaced with a link to the members area.

    i have looked into the Login-plugin, but can't use that as the customers cannot be administered by modx, as well as these pages cannot have restricted access.

    i tried using FormIt and set a cookie after successful login; but this is neither secure as practical, due to the fact that the login-form gets replaced after the next next page-load (not right after submitting the form).

    if i set a session-variable, then only the submitted page seems to have access to that session-variable; but not the other pages.

    any clues on how this can be achieved? with or without a session-variable (which i would prefer)?
    thanks in advance!!
      • 4172
      • 5,888 Posts
      but can't use that as the customers cannot be administered by modx

      why not?
      I think it would simplyfie things, if your customers would be modx-users.
      Can you import/synchronize your customers with the modx-users?

      Than you should be able to use login and other extras like personalize to get it done.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 42445
        • 9 Posts
        thanks for your reply Bruno17, but the customers are managed on a different system and implementing a synchronization does not seem very practical.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The user submits the login form, which submits to your user management system, then redirects the user back to the MODx page? Is the user management system on the same domain as the MODx installation? Does your user management system offer any kind of API to expose the user's status?
            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
            • 42445
            • 9 Posts
            Quote from: sottwell at Jan 04, 2013, 01:10 AM
            The user submits the login form, which submits to your user management system, then redirects the user back to the MODx page? Is the user management system on the same domain as the MODx installation?
            hi susan, i am looking for a solution without user management. preferrably by setting a session variable that is valid for the domain and not just the current ressource.
            any ideas on that?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I don't understand. How do you establish a "successful login"? The form has to post somewhere, to check against the user's credentials.
                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
                • 42445
                • 9 Posts
                i am using FormIt and a snippet as the hook for the verification; that snippet should verify the credentials and then set a session-variable on success.
                i could check on this session-variable on the following pages to see if the customer has logged in or not.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Set the $_SESSION['myfield'] value in the hook,
                  if($success) $_SESSION['myfield'] = 'true';


                  then use a simple snippet to check that session value and display the form or the link accordingly.
                  isset($_SESSION['myfield']) ? /* display link */ : /* display form */;
                    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
                    • 42445
                    • 9 Posts
                    this is what i want to achieve! but as it seems, the session-variable has a scope for only the ressource where it was set! the other pages on the site cannot access that session-variable. it just does not exist on any other pages. if i click back on the page where the variable was set - voila, the login-form will be replaced by the display link as desired.
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      The SESSION is valid on all pages within the same domain; are you going from domain.com to www.domain.com or vice verse? Where, exactly, is your FormIt form posting to? And what does that post action do?
                        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