[LON-CAPA-cvs] cvs: loncom /interface lonuserutils.pm

raeburn raeburn@source.lon-capa.org
Mon, 01 Nov 2010 18:01:26 -0000


raeburn		Mon Nov  1 18:01:26 2010 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm 
  Log:
  - Bug 5372.
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.127 loncom/interface/lonuserutils.pm:1.128
--- loncom/interface/lonuserutils.pm:1.127	Sun Sep 26 01:57:21 2010
+++ loncom/interface/lonuserutils.pm	Mon Nov  1 18:01:26 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.127 2010/09/26 01:57:21 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.128 2010/11/01 18:01:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3972,6 +3972,7 @@
             my @secs;
             my %entries=&Apache::loncommon::record_sep($line);
             # Determine user name
+            $entries{$fields{'username'}} =~ s/^\s+|\s+$//g;
             unless (($entries{$fields{'username'}} eq '') ||
                     (!defined($entries{$fields{'username'}}))) {
                 my ($fname, $mname, $lname,$gen) = ('','','','');
@@ -3992,11 +3993,17 @@
                         $gen=$entries{$fields{'gen'}};
                     }
                 }
+
                 if ($entries{$fields{'username'}}
                     ne &LONCAPA::clean_username($entries{$fields{'username'}})) {
+                    my $nowhitespace;
+                    if ($entries{$fields{'username'}} =~ /\s/) {
+                        $nowhitespace = ' - '.&mt('usernames may not contain spaces.');
+                    }
                     $r->print('<br />'.
       &mt('[_1]: Unacceptable username for user [_2] [_3] [_4] [_5]',
-          '<b>'.$entries{$fields{'username'}}.'</b>',$fname,$mname,$lname,$gen));
+          '<b>'.$entries{$fields{'username'}}.'</b>',$fname,$mname,$lname,$gen).
+                              $nowhitespace);
                     next;
                 } else {
                     if ($entries{$fields{'domain'}}