@Mobius 2000 - Email issue

Permalink
Hiya, I'm completely unable to post a reply to your email discussion - the reply spinny thing keeps on spinning and never closes the window - so I put it here, hope you notice it!

-----------

I haven't tested this but it would seem that...

If you *copy* the file /concrete/controllers/register.php into the /controllers directory and change line 63 in the newly copied file which looks like:

if (!$vals->email($_POST['uEmail'])) {


to:

if (!$vals->email($_POST['uEmail']) or !preg_match('/\@myemail.domain.com$/', $_POST['uEmail'])) {


then it should reject invalid emails AND emails that do not end in the domain you require.

You put your email domain into the '/\@myemail.domain.com$/' part of the altered code above, make sure you keep the '/\ and the $/' around the @my.email.domain portion of your email.

This is based on the latest C5 version, hopefully it will be line 63 in your version also!

Apologies in advanced if this doesn't work for you (or I missed a bracket :o!)

Let me know how you get on, if it's not happening for you then just delete that copied version of the file and all should return to normal, I hope I'm right assuming the copied file should override the original!

G

surefyre
 
mobius2000 replied on at Permalink Reply
Hi there, thank you so much for going to so much trouble to get a response to my discussion... This seems to work (only completed minimal testing).

Just wanted to check with you before I go and ruin anything on my end, how would I go setting it as /\.monash.edu.au$/ instead of outlining the full domain? We have a mountain of faculty specific addresses that we have to cater for as well (yourname@arts.monash.edu.au and yourname@law.monash.edu.au and so on).

I know I can simply change the script and try for myself but am just nervous about screwing any registrations up.
surefyre replied on at Permalink Reply
surefyre
No problem at all, it was bugging me that Reply seemed busted. A few other posts seemed to be suffering the same issue!

The preg_match function actually matches the end of the email address so if you just put the suffix you'd like to match into the expression you should be absolutely fine.

A quick note about regular expressions (regexes) which will help you understand the syntax a little:

/ .... / the opening and closing slashes are just enclosing characters, they could easily be # ... # or % ... % etc so long as they match.

$ means 'end of the string' so llo$ would match hello, cello but not yellow

. actually means 'any single character' so it was a bit naughty of me not to escape those in my example as monash.edu would actually match monashbedu, monashxedu, etc. If you want to literally match a fullstop character put \. like monash\.edu - the backslash character is a reserved escape character in regexes exactly like in a string in PHP, e.g. 'this is bob\'s house'.

So, anyway, you regex should look like:

'/\.monash\.edu$/' which means match anything ending in '.monash.edu' including the fullstops. Note that won't match jim@monash.edu, if you wanted to match that too you'd remove the initial \.

I'm sure you'll have it going in no time :o)

G