Loading...
 
Skip to main content

Custom Share Module 0.1dev

Features / Usability

Features / Usability


"Validate email address" feature? And domain filtering

posts: 38 United States

Hi folks,

I have tiki 1.8.4 installed on Linux (hosted at TigerTech.net), and everything seems to be working fine (after a quick hack to get around the SQL 4.1 limits problem). My question is this: what is the "Validate email address" login option supposed to do? It's not documented yet on doc.tiki.org. What I would *like* it to do is check the domain of the email given by the user while registering, and only allow emails matching a certain domain to register. I expect what it does instead is check the format of the email to see if it has some text, an @, and something that looks like a domain. (Since it says "may not work," I don't have it switched on.)

I'm just learning PHP, but I do code in other languages, so I can probably manage to make some changes to do what I need if someone can offer some pointers as to where I should be looking for this code and generally what sort of changes would be advisable.

Thanks,

e.d.

posts: 32 Iran

Of course it's what you are looking for.

To make the story short, there is a function named `SnowCheckMail`
in `lib/registration/registrationlib.php` that does the job. It runs several checks (email address form check, existence of the domain, validity of the host, and user existence) over the email address.

Good luck!


posts: 38 United States

Ok, I made the change. (It seems to take effect whether or not I have the email validation box checked... but that's ok.)

Now I'd also like to change the text on the registration page and the registration failure message to point out the domain name requirement. I grep'ed the lang/en/language.php file and found the strings I wanted and changed them, but I don't see the changes reflected in the tiki, even after compiling the language. I'm missing something.... any hints?

Thanks,

e.d.

posts: 38 United States

In case anyone else ever wonders, the change looks like this:

Change:

//Fix by suilinma

if (!eregi("
-_a-z0-9+(\\.-_a-z0-9+)*\\@(-a-z0-9+\\.)*(a-z{2,4})$", $Email)) {


to

if (!eregi("
-_a-z0-9+(\\.-_a-z0-9+)*\\@snhu\.edu$", $Email)) {


This validates against the domain snhu.edu.

You may also want to update the appropriate language.php file to make a more appropriate error message.

e.d.


Upcoming Events

1)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4) 
Tiki birthday
5)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting