phpScheduleIt
September 09, 2010, 04:54:27 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 1.2.11 has been released
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: validate email  (Read 4209 times)
aicasf
Newbie
*

Karma: 0
Posts: 7


View Profile
« on: October 23, 2008, 09:51:39 PM »

Hello all,
I am trying to configure phpscheduleit to only allow a certain domain to be used during self registration. i.e. billy@abc.com so will only allow folks with abc.com in there email to do self register. is there any way to do this? If so how? Any help with this is much appreciated!! Smiley Smiley Smiley
Logged
Nick
Administrator
Hero Member
*****

Karma: 1
Posts: 2710


View Profile WWW
« Reply #1 on: October 28, 2008, 01:54:40 PM »

Right after line 432 of lib/Auth.class.php, add the following:

Code:
if ( !empty($data['emailaddress']) && strpos($data['emailaddress'], '@abc.com') !== false ) {
$msg .= 'Only domain @abc.com is allowed' . '<br/>';
}
Logged
aicasf
Newbie
*

Karma: 0
Posts: 7


View Profile
« Reply #2 on: October 31, 2008, 05:08:48 PM »

I tried adding the code but it will allow them to register without using the domain i specified. here is the code

if ($use_logonname && empty($data['logon_name'])) {
         $msg .= translate('Valid username is required') . '<br/>';
      }
      else if ($use_logonname) {
         $data['logon_name'] = htmlspecialchars($data['logon_name']);
      }
      if (empty($data['emailaddress']) || !preg_match("/^[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/", $data['emailaddress']))
         $msg .= translate('Valid email address is required.') . '<br/>';
         if ( !empty($data['emailaddress']) && strpos($data['emailaddress'], '@aii.edu') !== false ) {
         $msg .= 'Only domain @aii.edu is allowed' . '<br/>';
      }
      if (empty($data['fname'])) {
         $msg .= translate('First name is required.') . '<br/>';

above is the code
Logged
aicasf
Newbie
*

Karma: 0
Posts: 7


View Profile
« Reply #3 on: October 31, 2008, 05:09:35 PM »

sorry iam using version 1.2 i posted in the wrong area maybe that is the issue
Logged
Nick
Administrator
Hero Member
*****

Karma: 1
Posts: 2710


View Profile WWW
« Reply #4 on: November 04, 2008, 09:33:05 AM »

I think I may have had my logic backwards.

This:
strpos($data['emailaddress'], '@aii.edu') !== false

Should be:
strpos($data['emailaddress'], '@aii.edu') === false
Logged
aicasf
Newbie
*

Karma: 0
Posts: 7


View Profile
« Reply #5 on: November 06, 2008, 12:36:41 PM »

Thanks so much it works but it says that only @aii.edu domain only even when the email domain is @aii.edu. It is almost there. What other change do I need to make to resolve this
Logged
Nick
Administrator
Hero Member
*****

Karma: 1
Posts: 2710


View Profile WWW
« Reply #6 on: November 06, 2008, 01:49:11 PM »

Hmm, I'm not sure here.  Try adding this code after: $msg .= 'Only domain @aii.edu is allowed' . '<br/>';

Code:
$msg .= 'strpos return value= ' . strpos($data['emailaddress'], '@aii.edu');

This should help provide some insight as to what's going wrong.
Logged
aicasf
Newbie
*

Karma: 0
Posts: 7


View Profile
« Reply #7 on: November 06, 2008, 04:27:39 PM »

 Smiley Thanks so much I really appreciate it
Logged
elena126
Newbie
*

Karma: 0
Posts: 1


View Profile
« Reply #8 on: January 29, 2010, 09:38:10 PM »

I think I may have had my logic backwards.

This:
strpos($data['emailaddress'], '@aii.edu') !== false

Should be:
strpos($data['emailaddress'], '@aii.edu') === false

yeah.that looks good! thanks Smiley

________________
small business loans bad credit
bad credit business loan
business loans
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!