[MKDoc-commit] Applied patch from Sam for checking email addresses

chris at mkdoc.demon.co.uk chris at mkdoc.demon.co.uk
Mon Feb 21 09:55:48 GMT 2005


Log Message:
-----------
Applied patch from Sam for checking email addresses

Tags:
----
mkdoc-1-6

Modified Files:
--------------
    mkd/flo/Record:
        Editor.pm
    mkd/flo/plugin/Account:
        Subscribe.pm

-------------- next part --------------
Index: Editor.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/Record/Editor.pm,v
retrieving revision 1.25.2.19
retrieving revision 1.25.2.20
diff -Lflo/Record/Editor.pm -Lflo/Record/Editor.pm -u -r1.25.2.19 -r1.25.2.20
--- flo/Record/Editor.pm
+++ flo/Record/Editor.pm
@@ -29,7 +29,6 @@
 use strict;
 use 5.008_000;
 use utf8;
-use vars qw /$HAVE_CHECKMAIL/;
 
 
 $Petal::Hash::MODIFIERS->{'user_root:'} = sub {
@@ -39,13 +38,6 @@
 };
 
 
-BEGIN
-{
-    eval "use Mail::CheckUser";
-    $HAVE_CHECKMAIL = 1 unless ($@);
-}
-
-
 ##
 # $class->new (%args);
 # --------------------
@@ -523,17 +515,6 @@
 	return 0;
     };
     
-    if ($HAVE_CHECKMAIL)
-    {
-	$Mail::CheckUser::Timeout = 5;
-	$Mail::CheckUser::Treat_Timeout_As_Fail = undef;
-	$Mail::CheckUser::Treat_Full_As_Fail = undef;
-	Mail::CheckUser::check_email ($mail) || do {
-	    new MKDoc::Ouch 'user/email/advanced_checks';
-	    return 0;
-	};
-    }
-    
     return 1;
 }
 
Index: Subscribe.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/plugin/Account/Attic/Subscribe.pm,v
retrieving revision 1.21.2.11
retrieving revision 1.21.2.12
diff -Lflo/plugin/Account/Subscribe.pm -Lflo/plugin/Account/Subscribe.pm -u -r1.21.2.11 -r1.21.2.12
--- flo/plugin/Account/Subscribe.pm
+++ flo/plugin/Account/Subscribe.pm
@@ -26,6 +26,13 @@
 use flo::Record::Editor;
 use flo::Standard;
 
+# pull in Mail::CheckUser and remember whether it worked or not
+use vars qw /$HAVE_CHECKMAIL/;
+BEGIN {
+    eval "use Mail::CheckUser";
+    $HAVE_CHECKMAIL = 1 unless ($@);
+}
+
 use Carp;
 use Petal;
 use Petal::Mail;
@@ -85,7 +92,18 @@
 	new MKDoc::Ouch 'subscribe/malformed_email';
 	return $self->http_get();
     };
-    
+
+    if ($HAVE_CHECKMAIL) {
+        # setup Mail::CheckUser options
+        local $Mail::CheckUser::Timeout = 5;
+        
+        # check the address using Mail::CheckUser
+        unless(Mail::CheckUser::check_email($email)) {
+            new MKDoc::Ouch 'user/email/advanced_checks';
+            return $self->http_get();
+        }
+    }
+
     $self->{email} = $email;
     $self->{ticket} = $self->_create_ticket ($email);
     $self->_send_mail ($self->{ticket});


More information about the MKDoc-commit mailing list