Changeset 483

Show
Ignore:
Timestamp:
08/10/06 12:49:38 (2 years ago)
Author:
ben
Message:

Administrators can now specify an email domain filter, to ensure the only people who can register in a system are those who hold an institutional address. e.g., setting 'elgg.net' as the filter will only allow users with email addresses @elgg.net to register. (This also allows for subdomains; ie, @foo.elgg.net and @bar.elgg.net will also be allowed to register.)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/config-dist.php

    r481 r483  
    4343    $CFG->publicinvite = true; 
    4444 
     45// If the following string is non-blank, it must be present within 
     46// the domains of email addresses of people signing up. For example,  
     47// if you set it to yourinstitution.edu, a user with the email address 
     48// foo@bar.yourinstitution.edu will be able to sign up. 
     49// This rule will hold true for both public registrations and invitations 
     50// from within the system (if either are enabled). 
     51 
     52    $CFG->emailfilter = ""; 
     53     
    4554// The following sets the default access level within the Elgg 
    4655// site. Possible values include: 
  • devel/lib/elgglib.php

    r454 r483  
    19671967 
    19681968/** 
    1969  * Validates an email to make sure it makes sense. 
     1969 * Validates an email to make sure it makes sense and adheres 
     1970 * to the email filter if it's set. 
    19701971 * 
    19711972 * @param string $address The email address to validate. 
     
    19741975function validate_email($address) { 
    19751976 
    1976     return (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. 
     1977    global $CFG; 
     1978     
     1979    if (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. 
    19771980                  '@'. 
    19781981                  '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. 
    19791982                  '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', 
    1980                   $address)); 
     1983                  $address)) { 
     1984                       
     1985                      if ($CFG->emailfilter != "") { 
     1986                          $domain = substr($address,strpos($address,"@")); 
     1987                          if (substr_count($domain,$CFG->emailfilter) == 0) { 
     1988                              return false; 
     1989                          } 
     1990                      } 
     1991                       
     1992                      return true; 
     1993                       
     1994                  } else { 
     1995                      return false; 
     1996                  } 
    19811997} 
    19821998 
  • devel/sanitychecks.php

    r481 r483  
    3535    if (!isset($CFG->publicinvite)) { 
    3636        $CFG->publicinvite = $CFG->publicreg; 
     37    } 
     38    if (!isset($CFG->emailfilter)) { 
     39        $CFG->emailfilter = ""; 
    3740    } 
    3841    if (!isset($CFG->walledgarden)) {