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

raeburn raeburn at source.lon-capa.org
Thu Aug 3 12:28:40 EDT 2017


raeburn		Thu Aug  3 16:28:40 2017 EDT

  Modified files:              
    /loncom/interface	loncoursequeueadmin.pm 
  Log:
  - User account requests which employ e-mail verification may have usernames
    which are different from the e-mail address used for verification.
  
  
Index: loncom/interface/loncoursequeueadmin.pm
diff -u loncom/interface/loncoursequeueadmin.pm:1.57 loncom/interface/loncoursequeueadmin.pm:1.58
--- loncom/interface/loncoursequeueadmin.pm:1.57	Thu Aug  3 16:11:46 2017
+++ loncom/interface/loncoursequeueadmin.pm	Thu Aug  3 16:28:39 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Utilities to administer domain course requests and course self-enroll requests
 #
-# $Id: loncoursequeueadmin.pm,v 1.57 2017/08/03 16:11:46 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.58 2017/08/03 16:28:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -880,10 +880,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'};
@@ -894,14 +894,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); 
@@ -922,8 +943,6 @@
                     } else {
                         push(@processing_errors,$uname);
                     }
-                } else {
-                    push(@processing_errors,$uname);
                 }
             } else {
                 push(@invalidusers,$uname);




More information about the LON-CAPA-cvs mailing list