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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 05 Jun 2008 12:55:06 -0000


raeburn		Thu Jun  5 08:55:06 2008 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  Bug 5728.
  $match_username requires a leading \w.
  If search term begins with @, prepend 'a' to searchterm before $match_username check.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.242 loncom/interface/loncreateuser.pm:1.243
--- loncom/interface/loncreateuser.pm:1.242	Wed Jun  4 17:24:20 2008
+++ loncom/interface/loncreateuser.pm	Thu Jun  5 08:55:04 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.242 2008/06/04 21:24:20 bisitz Exp $
+# $Id: loncreateuser.pm,v 1.243 2008/06/05 12:55:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3669,7 +3669,13 @@
     if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') ||
         ($srch->{'srchin'} eq 'alc')) {
         if ($srch->{'srchby'} eq 'uname') {
-            if ($srch->{'srchterm'} !~ /^$match_username$/) {
+            my $unamecheck = $srch->{'srchterm'};
+            if ($srch->{'srchtype'} eq 'contains') {
+                if ($unamecheck !~ /^\w/) {
+                    $unamecheck = 'a'.$unamecheck; 
+                }
+            }
+            if ($unamecheck !~ /^$match_username$/) {
                 $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');
             }
         }