--- loncom/interface/loncreateuser.pm 2007/08/16 21:48:20 1.175 +++ loncom/interface/loncreateuser.pm 2007/08/25 17:46:24 1.176 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.175 2007/08/16 21:48:20 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.176 2007/08/25 17:46:24 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2194,8 +2194,10 @@ sub user_search_result { my %inst_matches; my %srch_results; my ($response,$state,$forcenewuser); + $srch->{'srchterm'} =~ s/^\s+//; + $srch->{'srchterm'} =~ s/\s+$//; - if ($srch->{'srchby'} !~ /^(uname|lastname|lastfirst)$/) { + if ($srch->{'srchby'} !~ /^(uname|lastname|lastfirst)$/) { $response = &mt('Invalid search.'); } if ($srch->{'srchin'} !~ /^(crs|dom|alc|instd)$/) { @@ -2215,8 +2217,10 @@ sub user_search_result { } if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') || ($srch->{'srchin'} eq 'alc')) { - if ($srch->{'srchterm'} !~ /^$match_username$/) { - $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'); + if ($srch->{'srchby'} eq 'uname') { + if ($srch->{'srchterm'} !~ /^$match_username$/) { + $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'); + } } } if ($srch->{'srchin'} eq 'instd') {