We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52106
    • 2 Posts
    I am using Login 1.9.2 and was wondering if there is a way to block certain email addresses or domains from using the register form. I have been constantly getting bounce mails from newmail.printemailtext.com the last couple of days and now my web host is complaining and threatening to cancel my account because of the constant bounce mails going through the system.

    If there is no way of doing this, does any one know of a way to stop this? any help would be appreciated, thanks.

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      I think you could check the email address submitted in a Register prehook and abort the registration process by returning false from the prehook if it matches.
        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
      • discuss.answer
        • 17301
        • 932 Posts
        You could also do it with java script and check against a xml file either all the emails and key words you won't allow
          ■ email: [email protected] | ■ website: https://alienbuild.uk

          The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
          • 52106
          • 2 Posts
          Thanks BobRay, I always forget about prehooks, you can do almost anything with them.
          And thanks LK, I like that idea and will check into it too.
            • 3749
            • 24,544 Posts
            I like LK's idea. It might be simpler to implement.

            Just guessing here, but this should prevent the form from submitting with any email address from that domain (untested):

            [[StopBadEmail]]
            <form id='my-form' ... >




            /* StopBadEmail snippet */
            $js = "
            document.getElementById('my-form').onsubmit = function() {
                var substring = 'printemailtext.com';
                var email = document.getElementById('email').value {
                return  email.indexOf(substring) === -1? true : false;
            };"
            $modx->regClientStartupScript($js);
            
              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