[LON-CAPA-cvs] cvs: loncom(version_2_11_2_educog) /interface loncoursequeueadmin.pm

raeburn raeburn at source.lon-capa.org
Tue Aug 15 19:45:31 EDT 2017


raeburn		Tue Aug 15 23:45:31 2017 EDT

  Modified files:              (Branch: version_2_11_2_educog)
    /loncom/interface	loncoursequeueadmin.pm 
  Log:
  - Use 2.12 feature pre-release, in modified 2.11.2.
    Self-creation of user accounts using e-mail verification with settings
    dependent on requester's (self-reported) institutional status.
    - changes in rev. 1.57, 1.58
  
  
Index: loncom/interface/loncoursequeueadmin.pm
diff -u loncom/interface/loncoursequeueadmin.pm:1.52.2.2 loncom/interface/loncoursequeueadmin.pm:1.52.2.2.4.1
--- loncom/interface/loncoursequeueadmin.pm:1.52.2.2	Sun Oct 23 20:55:41 2016
+++ loncom/interface/loncoursequeueadmin.pm	Tue Aug 15 23:45:30 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Utilities to administer domain course requests and course self-enroll requests
 #
-# $Id: loncoursequeueadmin.pm,v 1.52.2.2 2016/10/23 20:55:41 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.52.2.2.4.1 2017/08/15 23:45:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -105,13 +105,13 @@
         $rawsubj = 'Self-enrollment requests processed';
         push(@rawmsg,{
                       mt => 'Enrollment requests in the following course: [_1] have been processed.',
-                      args => ["\n$contextdesc"],
+                      args => ["\n$contextdesc\n"],
                      });
     } elsif ($context eq 'domainmanagers') {
         $rawsubj = 'Course/Community requests reviewed';
         push(@rawmsg,{
-                      mt  => 'Course/Community creation requests in the following domain: "[_1]" have been reviewed.',
-                      args => ["\n$contextdesc"],
+                      mt  => 'Course/Community creation requests in the following domain: [_1] have been reviewed.',
+                      args => ["\n$contextdesc\n"],
                      });
         if (ref($textstr) eq 'ARRAY') {
             push(@rawmsg,@{$textstr});
@@ -119,8 +119,8 @@
     } elsif ($context eq 'authormanagers') {
         $rawsubj = 'Authoring Space requests reviewed';
         push(@rawmsg,{
-                      mt  => 'Authoring requests in the following domain: "[_1]" have been reviewed.',
-                      args => ["\n$contextdesc"],
+                      mt  => 'Authoring requests in the following domain: [_1] have been reviewed.',
+                      args => ["\n$contextdesc\n"],
                      });
         if (ref($textstr) eq 'ARRAY') {
             push(@rawmsg,@{$textstr});
@@ -128,8 +128,8 @@
     } elsif ($context eq 'usernamemanagers') {
         $rawsubj = 'LON-CAPA account requests reviewed';
         push(@rawmsg,{
-                      mt  => 'Account requests in the following domain: "[_1]" have been reviewed.',
-                      args => ["\n$contextdesc"],
+                      mt  => 'Account requests in the following domain: [_1] have been reviewed.',
+                      args => ["\n$contextdesc\n"],
                      });
         if (ref($textstr) eq 'ARRAY') {
             push(@rawmsg,@{$textstr});
@@ -879,10 +879,10 @@
             my $dbname = 'nohist_requestedusernames';
             my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom);
             my %curr = &Apache::lonnet::get($dbname,[$uname],$cdom,$domconfiguser);
-            
+
             if (ref($curr{$uname}) eq 'HASH') {
-                my ($username,$logtoken,$serverid,$encpass,$courseid,$id,$firstname,
-                    $middlename,$lastname,$generation,$inststatus);
+                my ($logtoken,$serverid,$encpass,$courseid,$id,$firstname,
+                    $middlename,$lastname,$generation,$inststatus,$email);
                 $curr{$uname}{'timestamp'} = $now;
                 $curr{$uname}{'adjudicator'} = $env{'user.name'}.':'.$env{'user.domain'};
                 $courseid   = $curr{$uname}{'courseid'};
@@ -893,14 +893,35 @@
                 $generation = $curr{$uname}{'generation'};
                 $inststatus = $curr{$uname}{'inststatus'};
 
-                my ($key,$caller)=split(/&/,$curr{$uname}{'tmpinfo'});
-                if ($caller eq 'createaccount') {
-                    my $upass = &Apache::loncommon::des_decrypt($key,$curr{$uname}{'upass'});
+                if ($curr{$uname}{'email'} ne '') {
+                    $email = $curr{$uname}{'email'};
+                } elsif ($uname =~ /^[^\@]+\@[^\@]+$/) {
+                    $email = $uname;
+                }
+
+                my $upass;
+                if ($curr{$uname}{'tmpinfo'}) {
+                    my ($key,$caller)=split(/&/,$curr{$uname}{'tmpinfo'});
+                    if ($caller eq 'createaccount') {
+                        if ($curr{$uname}{'upass'} eq '') {
+                            $upass = $curr{$uname}{'upass'};
+                        } else {
+                            $upass = &Apache::loncommon::des_decrypt($key,$curr{$uname}{'upass'});
+                        }
+                    } else {
+                        push(@processing_errors,$uname);
+                    }
+                } else {
+                    $upass = $curr{$uname}{'upass'};
+                }
+                if ($upass eq '') {
+                    push(@processing_errors,$uname);
+                } else {
                     undef($curr{$uname}{'upass'});
                     my $result =
                         &Apache::lonnet::modifyuser($cdom,$uname,$id,'internal',$upass,
                                                     $firstname,$middlename,$lastname,
-                                                    $generation,undef,undef,$uname);
+                                                    $generation,undef,undef,$email);
                     if ($result eq 'ok') {
                         $curr{$uname}{'status'} = 'created';
                         push(@completed,$uname); 
@@ -921,8 +942,6 @@
                     } else {
                         push(@processing_errors,$uname);
                     }
-                } else {
-                    push(@processing_errors,$uname);
                 }
             } else {
                 push(@invalidusers,$uname);




More information about the LON-CAPA-cvs mailing list