[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm
raeburn
raeburn@source.lon-capa.org
Tue, 06 Oct 2009 21:58:31 -0000
raeburn Tue Oct 6 21:58:31 2009 EDT
Modified files:
/loncom/auth lonlogin.pm
Log:
- Check if domain configuration for the server has been set to replace standard
log-in page wth redirection to a different server (e.g., a lonbalancer server).
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.125 loncom/auth/lonlogin.pm:1.126
--- loncom/auth/lonlogin.pm:1.125 Fri Sep 11 23:04:45 2009
+++ loncom/auth/lonlogin.pm Tue Oct 6 21:58:30 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Login Screen
#
-# $Id: lonlogin.pm,v 1.125 2009/09/11 23:04:45 raeburn Exp $
+# $Id: lonlogin.pm,v 1.126 2009/10/06 21:58:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -111,7 +111,24 @@
my $iconpath=
&Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
+ my $lonhost = $r->dir_config('lonHostID');
my $domain = &Apache::lonnet::default_login_domain();
+ my %domconfig = &Apache::loncommon::get_domainconf($domain);
+ if ($lonhost ne '') {
+ if (ref($domconfig{login}) eq 'HASH') {
+ if (ref($domconfig{login}{loginvia}) eq 'HASH') {
+ if ($domconfig{login}{loginvia}{$lonhost}) {
+ my $loginvia = $domconfig{login}{loginvia}{$lonhost};
+ my %servers = &Apache::lonnet::get_servers($domain);
+ if (($servers{$loginvia} ne '') && ($loginvia ne $lonhost)) {
+ $r->print(&redirect_page($loginvia));
+ return OK;
+ }
+ }
+ }
+ }
+ }
+
if (($env{'form.domain'}) &&
(&Apache::lonnet::domain($env{'form.domain'},'description'))) {
$domain=$env{'form.domain'};
@@ -119,7 +136,6 @@
my $role = $r->dir_config('lonRole');
my $loadlim = $r->dir_config('lonLoadLim');
my $servadm = $r->dir_config('lonAdmEMail');
- my $lonhost = $r->dir_config('lonHostID');
my $tabdir = $r->dir_config('lonTabDir');
my $include = $r->dir_config('lonIncludes');
my $expire = $r->dir_config('lonExpire');
@@ -506,6 +522,20 @@
return OK;
}
+sub redirect_page {
+ my ($desthost) = @_;
+ my $protocol = $Apache::lonnet::protocol{$desthost};
+ $protocol = 'http' if ($protocol ne 'https');
+ my $url = $protocol.'://'.&Apache::lonnet::hostname($desthost).'/';
+ if ($env{'form.firsturl'} ne '') {
+ $url .='?firsturl='.$env{'form.firsturl'};
+ }
+ my $start_page = &Apache::loncommon::start_page('Switching Server',undef,
+ {'redirect' => [0,$url],});
+ my $end_page = &Apache::loncommon::end_page();
+ return $start_page.$end_page;
+}
+
sub contactdisplay {
my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
my $contactblock;