--- loncom/interface/lonuserutils.pm 2012/02/08 16:27:28 1.136.6.1
+++ loncom/interface/lonuserutils.pm 2012/02/08 19:35:20 1.136.6.2
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.136.6.1 2012/02/08 16:27:28 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.136.6.2 2012/02/08 19:35:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -342,7 +342,8 @@ sub print_upload_manager_header {
."
\n");
$r->print(''.
&mt('Identify fields in uploaded list')."
\n");
- $r->print(&mt('Enter as many fields as you can.
The system will inform you and bring you back to this page,
if the data selected are insufficient to add users.')."
\n");
+ $r->print(&mt('Enter as many fields as you can.').'
'.
+ &mt('The system will inform you and bring you back to this page, [_1]if the data selected are insufficient to add users.','
')."
\n");
$r->print(&hidden_input('action','upload').
&hidden_input('state','got_file').
&hidden_input('associate','').
@@ -4180,10 +4181,32 @@ sub upfile_drop_add {
}
$checkid = 1;
$newuser = 1;
- my $user = $username.':'.$newuserdom;
+ if ($username =~/^[^\@]+\@[^\@]+$/) {
+ if ($email eq '') {
+ $email = $username;
+ }
+ my $lc_email;
+ if ($username eq $email) {
+ $lc_email = lc($email);
+ }
+ my $lc_username = lc($username);
+ if ($lc_username ne $username) {
+ if ($username eq $email) {
+ $email = $lc_username;
+ }
+ $username = $lc_username;
+ $uhome=&Apache::lonnet::homeserver($username,$userdomain);
+ if ($uhome ne 'no_host') {
+ $newuser = 0;
+ }
+ }
+ }
+ }
+ my $user = $username.':'.$newuserdom;
+ if ($newuser) {
my $checkhash;
my $checks = { 'username' => 1 };
- $checkhash->{$username.':'.$newuserdom} = { 'newuser' => 1, };
+ $checkhash->{$user} = { 'newuser' => 1, };
&Apache::loncommon::user_rule_check($checkhash,$checks,
\%alerts,\%rulematch,\%inst_results,\%curr_rules,
\%got_rules);
@@ -4205,8 +4228,13 @@ sub upfile_drop_add {
}
unless ($cancreate{$usertype}) {
my $showtype = $longtypes{$usertype};
- $r->print('
'.
- &mt('[_1]: The user does not exist, and you are not permitted to create users of type: [_2].',''.$username.'',$showtype));
+ if ($usertype eq 'unofficial') {
+ $r->print('
'.
+ &mt("[_1]: The user does not exist, and the new user's username must be an e-mail address.",''.$username.''));
+ } else {
+ $r->print('
'.
+ &mt("[_1]: The user does not exist, and you are not permitted to create users of type: [_2].",''.$username.'',$showtype));
+ }
next;
}
} else {