[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 28 Sep 2006 00:59:04 -0000


albertel		Wed Sep 27 20:59:04 2006 EDT

  Modified files:              
    /loncom/auth	lonlogin.pm 
  Log:
  - allow specifying addtional domains that can appear in the url for auto
    filling in the Domain filed with
  
  
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.80 loncom/auth/lonlogin.pm:1.81
--- loncom/auth/lonlogin.pm:1.80	Tue Sep 19 15:03:08 2006
+++ loncom/auth/lonlogin.pm	Wed Sep 27 20:59:02 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Login Screen
 #
-# $Id: lonlogin.pm,v 1.80 2006/09/19 19:03:08 albertel Exp $
+# $Id: lonlogin.pm,v 1.81 2006/09/28 00:59:02 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -41,6 +41,16 @@
 use LONCAPA;
  
 
+sub additional_machine_domains {
+    my @domains;
+    open(my $fh,"<".$Apache::lonnet::perlvar{'lonTabDir'}.'/expected_domains.tab');
+    while( my $line = <$fh>) {
+	$line =~ s/\s//g;
+	push(@domains,$line);
+    }
+    return @domains;
+}
+
 sub handler {
     my $r = shift;
 
@@ -130,7 +140,8 @@
                   $r->dir_config('lonIconsURL');
     my $domain  = $r->dir_config('lonDefDomain');
     my $testdomain=(split(/\./,$ENV{'HTTP_HOST'}))[0];
-    foreach my $posdom (&Apache::lonnet::current_machine_domains()) {
+    foreach my $posdom (&Apache::lonnet::current_machine_domains(),
+			&additional_machine_domains()) {
 	if (lc($posdom) eq lc($testdomain)) { $domain=$posdom; }
     }
     if (($env{'form.domain'}) &&