summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-10-26 10:31:12 -0400
committerCraig Andrews <candrews@integralblue.com>2009-10-26 10:31:12 -0400
commit0b4390e7f2322a15f16919425de039d555b3e516 (patch)
tree93c6d436161e42c93df2c089ef1000024ef74d89
parent3371e243165df54f41febcb1a8ab578ca5950a18 (diff)
Make email domain checking optional, as some statusnet installations (such as those behind restrictive corporate firewalls, or on home systems on restrictive connections) cannot connect to any mail
systems, and this check will always fail.
-rw-r--r--actions/emailsettings.php2
-rw-r--r--actions/invite.php2
-rw-r--r--actions/register.php2
-rw-r--r--config.php.sample4
-rw-r--r--lib/default.php3
-rw-r--r--plugins/OpenID/finishopenidlogin.php2
-rw-r--r--plugins/OpenID/openid.php2
7 files changed, 11 insertions, 6 deletions
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index 6eff06c0d..67b991cdc 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -326,7 +326,7 @@ class EmailsettingsAction extends AccountSettingsAction
$this->showForm(_('Cannot normalize that email address'));
return;
}
- if (!Validate::email($email, true)) {
+ if (!Validate::email($email, common_config('email', 'check_domain'))) {
$this->showForm(_('Not a valid email address'));
return;
} else if ($user->email == $email) {
diff --git a/actions/invite.php b/actions/invite.php
index 788130c58..3015202e9 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -68,7 +68,7 @@ class InviteAction extends CurrentUserDesignAction
foreach ($addresses as $email) {
$email = trim($email);
- if (!Validate::email($email, true)) {
+ if (!Validate::email($email, common_config('email', 'check_domain'))) {
$this->showForm(sprintf(_('Invalid email address: %s'), $email));
return;
}
diff --git a/actions/register.php b/actions/register.php
index 100ab7424..a6c1a903a 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -191,7 +191,7 @@ class RegisterAction extends Action
if (!$this->boolean('license')) {
$this->showForm(_('You can\'t register if you don\'t '.
'agree to the license.'));
- } else if ($email && !Validate::email($email, true)) {
+ } else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) {
$this->showForm(_('Not a valid email address.'));
} else if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
diff --git a/config.php.sample b/config.php.sample
index 997c9d6b0..9fccb84f3 100644
--- a/config.php.sample
+++ b/config.php.sample
@@ -104,6 +104,10 @@ $config['sphinx']['port'] = 3312;
// $config['site']['timezone'] = 'Pacific/Auckland';
// $config['site']['language'] = 'en_NZ';
+// When validating user supplied email addresses, validate if the domain
+// is running an SMTP server.
+// $config['mail']['check_domain'] = true;
+
// Email info, used for all outbound email
// $config['mail']['notifyfrom'] = 'microblog@example.net';
// $config['mail']['domain'] = 'microblog.example.net';
diff --git a/lib/default.php b/lib/default.php
index 30e43eefb..9f64cc9e4 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -84,7 +84,8 @@ $default =
'image' => 'http://i.creativecommons.org/l/by/3.0/80x15.png'),
'mail' =>
array('backend' => 'mail',
- 'params' => null),
+ 'params' => null,
+ 'domain_check' => true),
'nickname' =>
array('blacklist' => array(),
'featured' => array()),
diff --git a/plugins/OpenID/finishopenidlogin.php b/plugins/OpenID/finishopenidlogin.php
index 50a9c15c8..ff0b451d3 100644
--- a/plugins/OpenID/finishopenidlogin.php
+++ b/plugins/OpenID/finishopenidlogin.php
@@ -265,7 +265,7 @@ class FinishopenidloginAction extends Action
$fullname = '';
}
- if (!empty($sreg['email']) && Validate::email($sreg['email'], true)) {
+ if (!empty($sreg['email']) && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
$email = $sreg['email'];
} else {
$email = '';
diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php
index 0944117c0..b76497c28 100644
--- a/plugins/OpenID/openid.php
+++ b/plugins/OpenID/openid.php
@@ -241,7 +241,7 @@ function oid_update_user(&$user, &$sreg)
$orig_user = clone($user);
- if ($sreg['email'] && Validate::email($sreg['email'], true)) {
+ if ($sreg['email'] && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
$user->email = $sreg['email'];
}