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

raeburn raeburn at source.lon-capa.org
Wed Jun 5 08:46:39 EDT 2013


raeburn		Wed Jun  5 12:46:39 2013 EDT

  Modified files:              
    /loncom/interface	createaccount.pm 
  Log:
  - On multi-domain servers preserve information about domain in which user
    without an account is requesting creation of one, for domain where 
    self-creation of accounts is permitted.
  
  
Index: loncom/interface/createaccount.pm
diff -u loncom/interface/createaccount.pm:1.55 loncom/interface/createaccount.pm:1.56
--- loncom/interface/createaccount.pm:1.55	Tue Feb  5 15:45:18 2013
+++ loncom/interface/createaccount.pm	Wed Jun  5 12:46:39 2013
@@ -3,7 +3,7 @@
 # institutional log-in ID (institutional authentication required - localauth
 #  or kerberos) or an e-mail address.
 #
-# $Id: createaccount.pm,v 1.55 2013/02/05 15:45:18 raeburn Exp $
+# $Id: createaccount.pm,v 1.56 2013/06/05 12:46:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,15 +59,31 @@
     my $sso_username = $r->subprocess_env->get('REDIRECT_SSOUserUnknown');
     my $sso_domain = $r->subprocess_env->get('REDIRECT_SSOUserDomain');
 
-    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['token','courseid']);
+    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+                                            ['token','courseid','domain']);
     &Apache::lonacc::get_posted_cgi($r);
     &Apache::lonlocal::get_language_handle($r);
 
     if ($sso_username ne '' && $sso_domain ne '') {
         $domain = $sso_domain; 
     } else {
-        ($domain, undef) = Apache::lonnet::is_course($env{'form.courseid'}); 
-        $domain ||= &Apache::lonnet::default_login_domain();
+        ($domain, undef) = Apache::lonnet::is_course($env{'form.courseid'});
+        unless ($domain) {
+            if ($env{'form.phase'} =~ /^username_(activation|validation)$/) {
+                if (($env{'form.udom'} =~ /^$match_domain$/) &&
+                    (&Apache::lonnet::domain($env{'form.udom'}) ne '')) {
+                    $domain = $env{'form.udom'};
+                } else {
+                    $domain = &Apache::lonnet::default_login_domain();
+                }
+            } elsif (($env{'form.phase'} eq '') &&
+                     ($env{'form.domain'} =~ /^$match_domain$/) &&
+                     (&Apache::lonnet::domain($env{'form.domain'}) ne '')) {
+                $domain = $env{'form.domain'};
+            } else {
+                $domain = &Apache::lonnet::default_login_domain();
+            }
+        }
     }
     my $domdesc = &Apache::lonnet::domain($domain,'description');
     my $contact_name = &mt('LON-CAPA helpdesk');
@@ -1041,7 +1057,12 @@
         $output = &mt('Sorry, your authentication has expired.');
     }
     if ($earlyout ne '') {
-        $output .= '<br />'.&mt('Please [_1]start again[_2].','<a href="/adm/createaccount">','</a>');
+        my $link = '/adm/createaccount';
+        if (&Apache::lonnet::domain($domain) ne '') {
+            $link .= "?domain=$domain"; 
+        }
+        $output .= '<br />'.&mt('Please [_1]start again[_2].',
+                                '<a href="'.$link.'">','</a>');
         return($earlyout,$output);
     }
     if ((($domdefaults{'auth_def'} =~/^krb(4|5)$/) && 




More information about the LON-CAPA-cvs mailing list