--- loncom/auth/lonauth.pm 2013/12/20 15:03:55 1.121.2.7 +++ loncom/auth/lonauth.pm 2014/01/05 11:38:43 1.121.2.8 @@ -1,7 +1,7 @@ # The LearningOnline Network # User Authentication Module # -# $Id: lonauth.pm,v 1.121.2.7 2013/12/20 15:03:55 raeburn Exp $ +# $Id: lonauth.pm,v 1.121.2.8 2014/01/05 11:38:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -108,11 +108,11 @@ sub success { } $desturl = &HTML::Entities::encode($desturl,'"<>&'); $destsymb = &HTML::Entities::encode($destsymb,'"<>&'); - $destination .= '&destinationurl='.$desturl. + $destination .= 'destinationurl='.$desturl. '&destsymb='.$destsymb; } else { $destsymb = &HTML::Entities::encode($destsymb,'"<>&'); - $destination .= '&destinationurl='.$destsymb; + $destination .= 'destinationurl='.$destsymb; } } if ($destination =~ m{^/adm/roles}) { @@ -482,7 +482,17 @@ sub handler { if ($otherserver) { &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef, \%form); - $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl); + my $switchto = '/adm/switchserver?otherserver='.$otherserver; + if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) { + $switchto .= '&origurl='.$firsturl; + } + if ($form{'role'}) { + $switchto .= '&role='.$form{'role'}; + } + if ($form{'symb'}) { + $switchto .= '&symb='.$form{'symb'}; + } + $r->internal_redirect($switchto); } else { $r->print(&noswitch()); } @@ -493,7 +503,17 @@ sub handler { if ($otherserver) { &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef, \%form); - $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl); + my $switchto = '/adm/switchserver?otherserver='.$otherserver; + if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) { + $switchto .= '&origurl='.$firsturl; + } + if ($form{'role'}) { + $switchto .= '&role='.$form{'role'}; + } + if ($form{'symb'}) { + $switchto .= '&symb='.$form{'symb'}; + } + $r->internal_redirect($switchto); } else { $r->print(&noswitch()); }