[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /auth lonauth.pm

raeburn raeburn at source.lon-capa.org
Thu Sep 29 10:05:42 EDT 2011


raeburn		Thu Sep 29 14:05:42 2011 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/auth	lonauth.pm 
  Log:
  - Backport 1.119, and one line from 1.109, not included in earlier 1.101.8.4 (backport).  
  
  
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.101.8.7 loncom/auth/lonauth.pm:1.101.8.8
--- loncom/auth/lonauth.pm:1.101.8.7	Tue Sep 27 20:18:45 2011
+++ loncom/auth/lonauth.pm	Thu Sep 29 14:05:41 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # User Authentication Module
 #
-# $Id: lonauth.pm,v 1.101.8.7 2011/09/27 20:18:45 raeburn Exp $
+# $Id: lonauth.pm,v 1.101.8.8 2011/09/29 14:05:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -40,6 +40,7 @@
 use Apache::createaccount;
 use Fcntl qw(:flock);
 use Apache::lonlocal;
+use Apache::File();
 use HTML::Entities;
  
 # ------------------------------------------------------------ Successful login
@@ -331,21 +332,15 @@
     }
 
 # ---------------------------------------------------------------- Authenticate
-    my @cancreate;
+
     my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$form{'udom'});
-    if (ref($domconfig{'usercreation'}) eq 'HASH') {
-        if (ref($domconfig{'usercreation'}{'cancreate'}) eq 'HASH') {
-            if (ref($domconfig{'usercreation'}{'cancreate'}{'selfcreate'}) eq 'ARRAY') {
-                @cancreate = @{$domconfig{'usercreation'}{'cancreate'}{'selfcreate'}};
-            } elsif (($domconfig{'usercreation'}{'cancreate'}{'selfcreate'} ne 'none') && 
-                     ($domconfig{'usercreation'}{'cancreate'}{'selfcreate'} ne '')) {
-                @cancreate = ($domconfig{'usercreation'}{'cancreate'}{'selfcreate'});
-            }
-        }
-    }
+    my ($cancreate,$statustocreate) =
+        &Apache::createaccount::get_creation_controls($form{'udom'},$domconfig{'usercreation'});
     my $defaultauth;
-    if (grep(/^login$/, at cancreate)) {
-        $defaultauth = 1;
+    if (ref($cancreate) eq 'ARRAY') {
+        if (grep(/^login$/,@{$cancreate})) {
+            $defaultauth = 1;
+        }
     }
     my $clientcancheckhost = 1;
     my $authhost=Apache::lonnet::authenticate($form{'uname'},$upass,
@@ -359,12 +354,10 @@
 		\%form);
         return OK;
     } elsif ($authhost eq 'no_account_on_host') {
-        my %domconfig = 
-            &Apache::lonnet::get_dom('configuration',['usercreation'],$form{'udom'});
-        if (grep(/^login$/, at cancreate)) {
+        if ($defaultauth) {
             my $domdesc = &Apache::lonnet::domain($form{'udom'},'description');
             unless (&check_can_host($r,\%form,'no_account_on_host',$domdesc)) {
-                return OK;     
+                return OK;
             }
             my $start_page = 
                 &Apache::loncommon::start_page('Create a user account in LON-CAPA',
@@ -375,9 +368,11 @@
                 &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',
                                                         $form{'udom'},$origmail);
             my ($contact_email) = split(',',$contacts); 
-            my $output = &Apache::createaccount::username_check($form{'uname'}, 
-                                                                $form{'udom'},$domdesc,'',
-                                                                $lonhost,$contact_email,$contact_name);
+            my $output =
+                &Apache::createaccount::username_check($form{'uname'},$form{'udom'},
+                                                       $domdesc,'',$lonhost,
+                                                       $contact_email,$contact_name,
+                                                       undef,$statustocreate);
             &Apache::loncommon::content_type($r,'text/html');
             $r->send_http_header;
             &Apache::createaccount::print_header($r,$start_page);




More information about the LON-CAPA-cvs mailing list