[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface lonuserutils.pm
raeburn
raeburn@source.lon-capa.org
Sat, 13 Nov 2010 01:29:35 -0000
raeburn Sat Nov 13 01:29:35 2010 EDT
Modified files: (Branch: version_2_9_X)
/loncom/interface lonuserutils.pm
Log:
- Backport 1.128, 1.129.
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.97.2.19 loncom/interface/lonuserutils.pm:1.97.2.20
--- loncom/interface/lonuserutils.pm:1.97.2.19 Mon Nov 1 13:46:36 2010
+++ loncom/interface/lonuserutils.pm Sat Nov 13 01:29:34 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.97.2.19 2010/11/01 13:46:36 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.97.2.20 2010/11/13 01:29:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3924,6 +3924,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) = ('','','','');
@@ -3946,11 +3947,17 @@
}
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 {
+ $entries{$fields{'domain'}} =~ s/^\s+|\s+$//g;
if ($entries{$fields{'domain'}}
ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) {
$r->print('<br />'. '<b>'.$entries{$fields{'domain'}}.
@@ -4009,6 +4016,7 @@
# determine email address
my $email='';
if (defined($fields{'email'})) {
+ $entries{$fields{'email'}} =~ s/^\s+|\s+$//g;
if (defined($entries{$fields{'email'}})) {
$email=$entries{$fields{'email'}};
unless ($email=~/^[^\@]+\@[^\@]+$/) { $email=''; }
@@ -4055,7 +4063,7 @@
$role = $defaultrole;
}
# Clean up whitespace
- foreach (\$id,\$fname,\$mname,\$lname,\$gen) {
+ foreach (\$id,\$fname,\$mname,\$lname,\$gen,\$inststatus) {
$$_ =~ s/(\s+$|^\s+)//g;
}
# check against rules