[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Sat, 25 Aug 2007 17:46:27 -0000
raeburn Sat Aug 25 13:46:27 2007 EDT
Modified files:
/loncom/interface loncreateuser.pm
Log:
bug 5390 - only check if search term is valid username for uname type search
- trim leading and trailing spaces from search term.
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.175 loncom/interface/loncreateuser.pm:1.176
--- loncom/interface/loncreateuser.pm:1.175 Thu Aug 16 17:48:20 2007
+++ loncom/interface/loncreateuser.pm Sat Aug 25 13:46:24 2007
@@ -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 @@
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 @@
}
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') {