trim siteuser email param whitespace
authorAdrian Oldham <adriann@visualthought.com.au>
Tue, 18 Feb 2014 21:51:20 +0000 (08:51 +1100)
committerTony Cook <tony@develop-help.com>
Tue, 25 Feb 2014 23:00:08 +0000 (10:00 +1100)
site/cgi-bin/modules/BSE/AdminSiteUsers.pm
site/cgi-bin/modules/BSE/UserReg.pm

index 243b0484d73c62d76a25aefb61ca0e03d60a70f0..2cc7326434d6b8669c70f016ba1e526691d0534a 100644 (file)
@@ -13,7 +13,7 @@ use constant SITEUSER_GROUP_SECT => 'BSE Siteuser groups validation';
 use BSE::Template;
 use DevHelp::Date qw(dh_parse_date_sql dh_parse_time_sql);
 
-our $VERSION = "1.013";
+our $VERSION = "1.014";
 
 my %actions =
   (
@@ -371,6 +371,7 @@ sub req_save {
 
   my $saveemail;
   my $email = $cgi->param('email');
+  $email =~ s/^\s+|\s+$//g;
   if (defined $email && $email ne $user->{email} && $email ne '') {
     if ($email !~ /.\@./) {
       $errors{email} = "Email is invalid";
@@ -378,6 +379,7 @@ sub req_save {
     unless ($errors{email}) {
       if ($nopassword) {
        my $conf_email = $cgi->param('confirmemail');
+       $conf_email =~ s/^\s+|\s+$//g;
        if ($conf_email) {
          if ($conf_email eq $email) {
            my $other = SiteUsers->getBy(userId=>$email);
@@ -643,6 +645,7 @@ sub req_add {
   my $nopassword = $cfg->entryBool('site users', 'nopassword', 0);
   my %errors;
   my $email = $cgi->param('email');
+  $email =~ s/^\s+|\s+$//g;
   if (!defined $email) { # required check done later
     $email = ''; # prevent undefined value warnings later
   }
index 65e38191a4af3cea68f1cfbea921b644e196c63c..cf3ca72a48fc6d64f62efff914dac9b9b82b98d2 100644 (file)
@@ -18,7 +18,7 @@ use BSE::Util::Iterate;
 use base 'BSE::UI::UserCommon';
 use Carp qw(confess);
 
-our $VERSION = "1.029";
+our $VERSION = "1.030";
 
 use constant MAX_UNACKED_CONF_MSGS => 3;
 use constant MIN_UNACKED_CONF_GAP => 2 * 24 * 60 * 60;
@@ -626,6 +626,7 @@ sub req_register {
                 section => 'site user validation');
 
   my $email = $cgi->param('email');
+  $email =~ s/^\s+|\s+$//g;
   if (!defined $email or !length $email) {
     $errors{email} = $msgs->(regnoemail => "Please enter an email address");
     $email = ''; # prevent undefined value warnings later
@@ -635,6 +636,7 @@ sub req_register {
   }
   if ($nopassword) {
     my $confemail = $cgi->param('confirmemail');
+    $confemail =~ s/^\s+|\s+$//g;
     if (!defined $confemail or !length $confemail) {
       $errors{confirmemail} = $msgs->(regnoconfemail => "Please enter a confirmation email address");
     }
@@ -1122,6 +1124,7 @@ sub req_saveopts {
     }
   }
   my $email = $cgi->param('email');
+  $email =~ s/^\s+|\s+$//g;
   my $saveemail;
   if (defined $email) {
     ++$saveemail;