--- loncom/auth/switchserver.pm 2007/09/08 02:43:33 1.16 +++ loncom/auth/switchserver.pm 2007/09/29 04:03:46 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network # Switch Servers Handler # -# $Id: switchserver.pm,v 1.16 2007/09/08 02:43:33 raeburn Exp $ +# $Id: switchserver.pm,v 1.17 2007/09/29 04:03:46 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -83,8 +83,15 @@ sub handler { ['otherserver','role']); my $switch_to=&Apache::lonnet::hostname($env{'form.otherserver'}); - if (!$env{'form.otherserver'}) { - $env{'form.otherserver'}=&Apache::lonnet::spareserver(30000,undef,1); + if (! $env{'form.otherserver'}) { + $env{'form.otherserver'} = + &Apache::lonnet::find_existing_session($env{'user.domain'}, + $env{'user.name'}); + if (! $env{'form.otherserver'}) { + $env{'form.otherserver'} = + &Apache::lonnet::spareserver(30000,undef,1); + } + $switch_to=&Apache::lonnet::hostname($env{'form.otherserver'}); }